mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 06:19:36 +00:00
tex2lyx: support for pdfpages
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@40370 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
148acd3808
commit
fd2ff50b69
@ -718,6 +718,9 @@ void Preamble::handle_package(Parser &p, string const & name,
|
|||||||
else if (name == "textcomp")
|
else if (name == "textcomp")
|
||||||
; // ignore this FIXME: Use the package separator mechanism instead
|
; // ignore this FIXME: Use the package separator mechanism instead
|
||||||
|
|
||||||
|
else if (name == "pdfpages")
|
||||||
|
; // ignore this
|
||||||
|
|
||||||
else if (name == "lyxskak") {
|
else if (name == "lyxskak") {
|
||||||
// ignore this and its options
|
// ignore this and its options
|
||||||
if (!options.empty())
|
if (!options.empty())
|
||||||
|
@ -13,9 +13,8 @@ Format LaTeX feature LyX feature
|
|||||||
224 external insets defined in InsetExternal
|
224 external insets defined in InsetExternal
|
||||||
lib/external_templates.
|
lib/external_templates.
|
||||||
(Date and RasterImage cannot be supported
|
(Date and RasterImage cannot be supported
|
||||||
(Chess diagram and Spreadsheet are supported)
|
(Chess diagram, PDF pages and Spreadsheet are supported)
|
||||||
(Xfig figure, Lilypond, Dia diagram can be supported by looking at the file extension)
|
(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
|
||||||
|
@ -3910,6 +3910,74 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
end_inset(os);
|
end_inset(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (t.cs() == "includepdf") {
|
||||||
|
p.skip_spaces();
|
||||||
|
string const arg = p.getArg('[', ']');
|
||||||
|
map<string, string> opts;
|
||||||
|
vector<string> keys;
|
||||||
|
split_map(arg, opts, keys);
|
||||||
|
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 pdfpages_format[] = {"pdf", 0};
|
||||||
|
string const pdftex_name =
|
||||||
|
find_file(name, path, pdfpages_format);
|
||||||
|
if (!pdftex_name.empty()) {
|
||||||
|
name = pdftex_name;
|
||||||
|
pdflatex = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (makeAbsPath(name, path).exists())
|
||||||
|
fix_relative_filename(name);
|
||||||
|
else
|
||||||
|
cerr << "Warning: Could not find file '"
|
||||||
|
<< name << "'." << endl;
|
||||||
|
// write output
|
||||||
|
context.check_layout(os);
|
||||||
|
begin_inset(os, "External\n\ttemplate ");
|
||||||
|
os << "PDFPages\n\tfilename "
|
||||||
|
<< name << "\n";
|
||||||
|
// parse the options
|
||||||
|
if (opts.find("pages") != opts.end())
|
||||||
|
os << "\textra LaTeX \"pages="
|
||||||
|
<< opts["pages"] << "\"\n";
|
||||||
|
if (opts.find("angle") != opts.end())
|
||||||
|
os << "\trotateAngle "
|
||||||
|
<< opts["angle"] << '\n';
|
||||||
|
if (opts.find("origin") != opts.end()) {
|
||||||
|
ostringstream ss;
|
||||||
|
string const opt = opts["origin"];
|
||||||
|
if (opt == "tl") ss << "topleft";
|
||||||
|
if (opt == "bl") ss << "bottomleft";
|
||||||
|
if (opt == "Bl") ss << "baselineleft";
|
||||||
|
if (opt == "c") ss << "center";
|
||||||
|
if (opt == "tc") ss << "topcenter";
|
||||||
|
if (opt == "bc") ss << "bottomcenter";
|
||||||
|
if (opt == "Bc") ss << "baselinecenter";
|
||||||
|
if (opt == "tr") ss << "topright";
|
||||||
|
if (opt == "br") ss << "bottomright";
|
||||||
|
if (opt == "Br") ss << "baselineright";
|
||||||
|
if (!ss.str().empty())
|
||||||
|
os << "\trotateOrigin " << ss.str() << '\n';
|
||||||
|
else
|
||||||
|
cerr << "Warning: Ignoring unknown includegraphics origin argument '" << opt << "'\n";
|
||||||
|
}
|
||||||
|
if (opts.find("width") != opts.end())
|
||||||
|
os << "\twidth "
|
||||||
|
<< translate_len(opts["width"]) << '\n';
|
||||||
|
if (opts.find("height") != opts.end())
|
||||||
|
os << "\theight "
|
||||||
|
<< translate_len(opts["height"]) << '\n';
|
||||||
|
if (opts.find("keepaspectratio") != opts.end())
|
||||||
|
os << "\tkeepAspectRatio\n";
|
||||||
|
end_inset(os);
|
||||||
|
context.check_layout(os);
|
||||||
|
}
|
||||||
|
|
||||||
else if (t.cs() == "loadgame") {
|
else if (t.cs() == "loadgame") {
|
||||||
p.skip_spaces();
|
p.skip_spaces();
|
||||||
string name = normalize_filename(p.verbatim_item());
|
string name = normalize_filename(p.verbatim_item());
|
||||||
|
Loading…
Reference in New Issue
Block a user