mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
tex2lyx: support for Spreadsheet and chess external templates
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40270 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
62369a7086
commit
2906a35663
@ -727,10 +727,17 @@ void Preamble::handle_package(Parser &p, string const & name,
|
|||||||
else if (name == "textcomp")
|
else if (name == "textcomp")
|
||||||
; // ignore this
|
; // ignore this
|
||||||
|
|
||||||
|
else if (name == "lyxskak") {
|
||||||
|
// ignore this and its options
|
||||||
|
if (!options.empty())
|
||||||
|
options.clear();
|
||||||
|
}
|
||||||
|
|
||||||
else if (name == "url")
|
else if (name == "url")
|
||||||
; // ignore this
|
; // ignore this
|
||||||
|
|
||||||
else if (name == "booktabs" || name == "color" ||
|
else if (name == "array" || name == "booktabs" ||
|
||||||
|
name == "color" || name == "hhline" ||
|
||||||
name == "longtable" || name == "subscript" ||
|
name == "longtable" || name == "subscript" ||
|
||||||
name == "ulem") {
|
name == "ulem") {
|
||||||
if (!in_lyx_preamble)
|
if (!in_lyx_preamble)
|
||||||
@ -1146,6 +1153,11 @@ void Preamble::parse(Parser & p, string const & forceclass,
|
|||||||
h_font_default_family = family.erase(0,1);
|
h_font_default_family = family.erase(0,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove the lyxdot definition that is re-added by LyX
|
||||||
|
// if necessary
|
||||||
|
if (name == "\\lyxdot")
|
||||||
|
in_lyx_preamble = true;
|
||||||
|
|
||||||
// Add the command to the known commands
|
// Add the command to the known commands
|
||||||
add_known_command(name, opt1, !opt2.empty(), from_utf8(body));
|
add_known_command(name, opt1, !opt2.empty(), from_utf8(body));
|
||||||
|
|
||||||
|
@ -11,8 +11,11 @@ LyX feature: LyX inset or document setting
|
|||||||
|
|
||||||
Format LaTeX feature LyX feature
|
Format LaTeX feature LyX feature
|
||||||
224 external insets defined in InsetExternal
|
224 external insets defined in InsetExternal
|
||||||
lib/external_templates. This is
|
lib/external_templates.
|
||||||
quite difficult to recognize.
|
(Date and RasterImage cannot be supported
|
||||||
|
(Chess diagram and Spreadsheet are supported)
|
||||||
|
(Xfig figure, Lilypond, Dia diagram can be supported by looking at the file extension)
|
||||||
|
(for PDFpages work is in progress by uwestoehr)
|
||||||
226 nothing (impossible to import) InsetBranch, \branch...\end_branch
|
226 nothing (impossible to import) InsetBranch, \branch...\end_branch
|
||||||
226 transformations InsetExternal
|
226 transformations InsetExternal
|
||||||
228 draft InsetExternal
|
228 draft InsetExternal
|
||||||
|
@ -114,8 +114,19 @@ M., \& Rasio, F.~A. 2004, ApJ, 604, 632\end{thebibliography}
|
|||||||
\section{Input files\index{Input files}}
|
\section{Input files\index{Input files}}
|
||||||
|
|
||||||
We can input files too, like this \input{DummyDocument}, or with the include
|
We can input files too, like this \input{DummyDocument}, or with the include
|
||||||
variant \include{DummyDocument} % unfortunately, including the doc twice
|
variant \include{DummyDocument} % unfortunately, including the doc twice generates a multiply defined label
|
||||||
% generates a multiply defined label
|
|
||||||
|
We can also import chess diagrams:
|
||||||
|
|
||||||
|
\loadgame{../../../lib/examples/iecc05}\showboard
|
||||||
|
|
||||||
|
Spreadsheets:
|
||||||
|
|
||||||
|
\def\inputGnumericTable{}\input{../../../lib/examples/longsheet.gnumeric}
|
||||||
|
|
||||||
|
and PDF pages:
|
||||||
|
|
||||||
|
\includepdf[pages=-,angle=22,origin=Bl,width=5cm,height=40mm,keepaspectratio]{../../../lib/examples/beamer-icsi-logo}
|
||||||
|
|
||||||
If you prefer verbatim input, you can choose
|
If you prefer verbatim input, you can choose
|
||||||
between~\verbatiminput{foo} or~\verbatiminput*{foo}.
|
between~\verbatiminput{foo} or~\verbatiminput*{foo}.
|
||||||
|
@ -2306,8 +2306,45 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (is_macro(p))
|
else if (is_macro(p)) {
|
||||||
|
// catch the case of \def\inputGnumericTable
|
||||||
|
if (t.cs() == "def") {
|
||||||
|
Token second = p.get_token();
|
||||||
|
if (second.cs() == "inputGnumericTable") {
|
||||||
|
skip_braces(p);
|
||||||
|
Token third = p.get_token();
|
||||||
|
if (third.cs() == "input") {
|
||||||
|
string name = normalize_filename(p.verbatim_item());
|
||||||
|
string const path = getMasterFilePath();
|
||||||
|
// We want to preserve relative / absolute filenames,
|
||||||
|
// therefore path is only used for testing
|
||||||
|
if (!makeAbsPath(name, path).exists()) {
|
||||||
|
// The file extension is probably missing.
|
||||||
|
// Now try to find it out.
|
||||||
|
char const * const Gnumeric_formats[] = {"gnumeric"
|
||||||
|
"ods", "xls", 0};
|
||||||
|
string const Gnumeric_name =
|
||||||
|
find_file(name, path, Gnumeric_formats);
|
||||||
|
if (!Gnumeric_name.empty())
|
||||||
|
name = Gnumeric_name;
|
||||||
|
}
|
||||||
|
if (makeAbsPath(name, path).exists())
|
||||||
|
fix_relative_filename(name);
|
||||||
|
else
|
||||||
|
cerr << "Warning: Could not find file '"
|
||||||
|
<< name << "'." << endl;
|
||||||
|
context.check_layout(os);
|
||||||
|
begin_inset(os, "External\n\ttemplate ");
|
||||||
|
os << "GnumericSpreadsheet\n\tfilename "
|
||||||
|
<< name << "\n";
|
||||||
|
end_inset(os);
|
||||||
|
context.check_layout(os);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_macro(p))
|
||||||
parse_macro(p, os, context);
|
parse_macro(p, os, context);
|
||||||
|
}
|
||||||
|
|
||||||
else if (t.cs() == "noindent") {
|
else if (t.cs() == "noindent") {
|
||||||
p.skip_spaces();
|
p.skip_spaces();
|
||||||
@ -3822,6 +3859,37 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
end_inset(os);
|
end_inset(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (t.cs() == "loadgame") {
|
||||||
|
p.skip_spaces();
|
||||||
|
string name = normalize_filename(p.verbatim_item());
|
||||||
|
string const path = getMasterFilePath();
|
||||||
|
// We want to preserve relative / absolute filenames,
|
||||||
|
// therefore path is only used for testing
|
||||||
|
if (!makeAbsPath(name, path).exists()) {
|
||||||
|
// The file extension is probably missing.
|
||||||
|
// Now try to find it out.
|
||||||
|
char const * const lyxskak_format[] = {"fen", 0};
|
||||||
|
string const lyxskak_name =
|
||||||
|
find_file(name, path, lyxskak_format);
|
||||||
|
if (!lyxskak_name.empty())
|
||||||
|
name = lyxskak_name;
|
||||||
|
}
|
||||||
|
if (makeAbsPath(name, path).exists())
|
||||||
|
fix_relative_filename(name);
|
||||||
|
else
|
||||||
|
cerr << "Warning: Could not find file '"
|
||||||
|
<< name << "'." << endl;
|
||||||
|
context.check_layout(os);
|
||||||
|
begin_inset(os, "External\n\ttemplate ");
|
||||||
|
os << "ChessDiagram\n\tfilename "
|
||||||
|
<< name << "\n";
|
||||||
|
end_inset(os);
|
||||||
|
context.check_layout(os);
|
||||||
|
// after a \loadgame follows a \showboard
|
||||||
|
if (p.get_token().asInput() == "showboard")
|
||||||
|
p.get_token();
|
||||||
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
// try to see whether the string is in unicodesymbols
|
// try to see whether the string is in unicodesymbols
|
||||||
// Only use text mode commands, since we are in text mode here,
|
// Only use text mode commands, since we are in text mode here,
|
||||||
|
Loading…
Reference in New Issue
Block a user