else if (name == "textcomp")
; // ignore this
+ else if (name == "lyxskak") {
+ // ignore this and its options
+ if (!options.empty())
+ options.clear();
+ }
+
else if (name == "url")
; // ignore this
- else if (name == "booktabs" || name == "color" ||
- name == "longtable" || name == "subscript" ||
- name == "ulem") {
+ else if (name == "array" || name == "booktabs" ||
+ name == "color" || name == "hhline" ||
+ name == "longtable" || name == "subscript" ||
+ name == "ulem") {
if (!in_lyx_preamble)
h_preamble << package_beg_sep << name
<< package_mid_sep << "\\usepackage{"
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_known_command(name, opt1, !opt2.empty(), from_utf8(body));
\section{Input files\index{Input files}}
We can input files too, like this \input{DummyDocument}, or with the include
-variant \include{DummyDocument} % unfortunately, including the doc twice
-% generates a multiply defined label
+variant \include{DummyDocument} % unfortunately, including the doc twice 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
between~\verbatiminput{foo} or~\verbatiminput*{foo}.
}
}
- else if (is_macro(p))
- parse_macro(p, os, context);
+ 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);
+ }
else if (t.cs() == "noindent") {
p.skip_spaces();
t.cs() == "DeclareRobustCommandx" ||
t.cs() == "newcommand" ||
t.cs() == "newcommandx" ||
- t.cs() == "providecommand" ||
+ t.cs() == "providecommand" ||
t.cs() == "providecommandx" ||
t.cs() == "renewcommand" ||
t.cs() == "renewcommandx") {
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 {
// try to see whether the string is in unicodesymbols
// Only use text mode commands, since we are in text mode here,