From 30eb6dfaebe1df2b38bcc4e69302a5ad2c2d1952 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Fri, 1 Sep 2017 10:27:12 +0200 Subject: [PATCH] Add special chain for Modules with OutputFormat for pLaTeX (Japanese) Fixes: #8823 --- lib/configure.py | 12 ++++++++++-- src/BufferParams.cpp | 12 ++++++++++-- src/Converter.cpp | 3 ++- src/TextClass.cpp | 6 ++++-- src/TextClass.h | 4 ++++ 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/lib/configure.py b/lib/configure.py index a9f161ef7e..bda55ddbfe 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -638,10 +638,13 @@ def checkFormatEntries(dtl_tools): \Format platex tex "LaTeX (pLaTeX)" "" "" "%%" "document,menu=export" "" \Format literate nw NoWeb N "" "%%" "document,menu=export" "" \Format sweave Rnw "Sweave" S "" "%%" "document,menu=export" "" +\Format sweave-ja Rnw "Sweave (Japanese)" S "" "%%" "document,menu=export" "" \Format r R "R/S code" "" "" "%%" "document,menu=export" "" \Format knitr Rnw "Rnw (knitr)" "" "" "%%" "document,menu=export" "" +\Format knitr-ja Rnw "Rnw (knitr, Japanese)" "" "" "%%" "document,menu=export" "" \Format lilypond ly "LilyPond music" "" "" "%%" "vector" "text/x-lilypond" \Format lilypond-book lytex "LilyPond book (LaTeX)" "" "" "%%" "document,menu=export" "" +\Format lilypond-book-ja lytex "LilyPond book (pLaTeX)" "" "" "%%" "document,menu=export" "" \Format latex tex "LaTeX (plain)" L "" "%%" "document,menu=export" "text/x-tex" \Format luatex tex "LaTeX (LuaTeX)" "" "" "%%" "document,menu=export" "" \Format pdflatex tex "LaTeX (pdflatex)" "" "" "%%" "document,menu=export" "" @@ -793,6 +796,7 @@ def checkConverterEntries(): checkProg('a Sweave -> LaTeX converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxsweave.R $$p$$i $$p$$o $$e $$r'], rc_entry = [r'''\converter sweave latex "%%" "needauth" \converter sweave pdflatex "%%" "needauth" +\converter sweave-ja platex "%%" "needauth" \converter sweave xetex "%%" "needauth" \converter sweave luatex "%%" "needauth" \converter sweave dviluatex "%%" "needauth"''']) @@ -800,15 +804,18 @@ def checkConverterEntries(): checkProg('a knitr -> LaTeX converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxknitr.R $$p$$i $$p$$o $$e $$r'], rc_entry = [r'''\converter knitr latex "%%" "needauth" \converter knitr pdflatex "%%" "needauth" +\converter knitr-ja platex "%%" "needauth" \converter knitr xetex "%%" "needauth" \converter knitr luatex "%%" "needauth" \converter knitr dviluatex "%%" "needauth"''']) # checkProg('a Sweave -> R/S code converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxstangle.R $$i $$e $$r'], - rc_entry = [ r'\converter sweave r "%%" "needauth"' ]) + rc_entry = [ r'\converter sweave r "%%" "needauth"', + r'\converter sweave-ja r "%%" "needauth"' ]) # checkProg('a knitr -> R/S code converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxknitr.R $$p$$i $$p$$o $$e $$r tangle'], - rc_entry = [ r'\converter knitr r "%%" "needauth"' ]) + rc_entry = [ r'\converter knitr r "%%" "needauth"', + r'\converter knitr-ja r "%%" "needauth"' ]) # checkProg('an HTML -> LaTeX converter', ['html2latex $$i', 'gnuhtml2latex', 'htmltolatex -input $$i -output $$o', 'htmltolatex.jar -input $$i -output $$o'], @@ -1116,6 +1123,7 @@ def checkConverterEntries(): # this, use different output folders for eps and pdf outputs. addToRC(r'\converter lilypond-book latex "lilypond-book --safe --lily-output-dir=ly-eps $$i" ""') addToRC(r'\converter lilypond-book pdflatex "lilypond-book --safe --pdf --latex-program=pdflatex --lily-output-dir=ly-pdf $$i" ""') + addToRC(r'\converter lilypond-book-ja platex "lilypond-book --safe --pdf --latex-program=platex --lily-output-dir=ly-pdf $$i" ""') addToRC(r'\converter lilypond-book xetex "lilypond-book --safe --pdf --latex-program=xelatex --lily-output-dir=ly-pdf $$i" ""') addToRC(r'\converter lilypond-book luatex "lilypond-book --safe --pdf --latex-program=lualatex --lily-output-dir=ly-pdf $$i" ""') addToRC(r'\converter lilypond-book dviluatex "lilypond-book --safe --latex-program=dvilualatex --lily-output-dir=ly-eps $$i" ""') diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 444cb5cf42..5e8f6126dd 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -2621,8 +2621,16 @@ vector BufferParams::backends() const v.push_back("luatex"); v.push_back("dviluatex"); } - } else - v.push_back(buffmt); + } else { + string rbuffmt = buffmt; + // If we use an OutputFormat in Japanese docs, + // we need special format in order to get the path + // via pLaTeX (#8823) + if (documentClass().hasOutputFormat() + && encoding().package() == Encoding::japanese) + rbuffmt += "-ja"; + v.push_back(rbuffmt); + } v.push_back("xhtml"); v.push_back("text"); diff --git a/src/Converter.cpp b/src/Converter.cpp index 997789bcda..664a4bb718 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -449,7 +449,8 @@ bool Converters::convert(Buffer const * buffer, if (buffer) { runparams.use_japanese = - buffer->params().bufferFormat() == "latex" + (buffer->params().bufferFormat() == "latex" + || suffixIs(buffer->params().bufferFormat(), "-ja")) && buffer->params().encoding().package() == Encoding::japanese; runparams.use_indices = buffer->params().use_indices; runparams.bibtex_command = buffer->params().bibtexCommand(); diff --git a/src/TextClass.cpp b/src/TextClass.cpp index eb79e13eae..7729ddbe34 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -152,7 +152,7 @@ TextClass::TextClass() opt_enginetype_("authoryear|numerical"), opt_fontsize_("10|11|12"), opt_pagestyle_("empty|plain|headings|fancy"), pagestyle_("default"), columns_(1), sides_(OneSide), secnumdepth_(3), tocdepth_(3), - outputType_(LATEX), outputFormat_("latex"), + outputType_(LATEX), outputFormat_("latex"), has_output_format_(false), defaultfont_(sane_font), titletype_(TITLE_COMMAND_AFTER), titlename_("maketitle"), min_toclevel_(0), max_toclevel_(0), maxcitenames_(2), @@ -445,8 +445,10 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt) break; case TC_OUTPUTFORMAT: - if (lexrc.next()) + if (lexrc.next()) { outputFormat_ = lexrc.getString(); + has_output_format_ = true; + } break; case TC_OUTPUTTYPE: diff --git a/src/TextClass.h b/src/TextClass.h index 9fc8b19b42..570e67f8d4 100644 --- a/src/TextClass.h +++ b/src/TextClass.h @@ -207,6 +207,8 @@ public: OutputType outputType() const { return outputType_; } /// Can be latex, docbook ... (the name of a format) std::string outputFormat() const { return outputFormat_; } + /// Does this class redefine the output format? + bool hasOutputFormat() const { return has_output_format_; } /// Return the non-localised names for the toc types. std::map const & outlinerNames() const { return outliner_names_; } @@ -313,6 +315,8 @@ protected: OutputType outputType_; /// Can be latex, docbook ... (the name of a format) std::string outputFormat_; + /// Does this class redefine the output format? + bool has_output_format_; /** Base font. The paragraph and layout fonts are resolved against this font. This has to be fully instantiated. Attributes FONT_INHERIT, FONT_IGNORE, and FONT_TOGGLE are -- 2.39.2