From b7304601e0d59d0d65dfe3b97a49b11ffb15c6c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Mon, 8 Jun 2009 16:04:11 +0000 Subject: [PATCH] backport revision 29238 URL: http://www.lyx.org/trac/changeset/29238 Log: * Properly separate the specific Japanese (i.e., pLaTeX) auxiliary programs (jbibtex, mendex) from the standard LaTeX programs. These programs are only used now if the document actually uses Japanese, not always if they are found. (bug 5601 a.o.). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@30020 a592a061-630c-0410-9148-cb99ea01b6c8 --- RELEASE-NOTES | 4 - lib/configure.py | 6 +- src/Converter.cpp | 3 + src/LaTeX.cpp | 15 +- src/LaTeX.h | 2 +- src/LyXFunc.cpp | 2 + src/LyXRC.cpp | 36 +++++ src/LyXRC.h | 6 + src/frontends/qt4/GuiPrefs.cpp | 8 + src/frontends/qt4/ui/PrefLatexUi.ui | 234 ++++++++++++++++------------ status.16x | 4 +- 11 files changed, 208 insertions(+), 112 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 8dd823633c..da468f29fa 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -235,10 +235,6 @@ Known issues in version 1.6.x * Documents using this method can be backported to 1.5 in principal, but the backported documents are not guaranteed to work, since 1.5 falls back to the CJK package; expect the output to differ. - * pLaTeX provides a Japanese variant of BibTeX named "jbibtex", which will - be selected automatically by LyX. If you run into problems with this or - if you need to use an alternative BibTeX program, you can change this - setting in the LyX preferences (Output->LaTeX->BibTeX command). Caveats when upgrading from earlier versions to 1.6.x diff --git a/lib/configure.py b/lib/configure.py index 8ed44f9ede..e9357c91ff 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -597,10 +597,14 @@ def checkOtherEntries(): r'\plaintext_roff_command ""' ]) checkProg('ChkTeX', ['chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38'], rc_entry = [ r'\chktex_command "%%"' ]) - checkProg('BibTeX', ['jbibtex', 'bibtex'], + checkProg('BibTeX', ['bibtex'], rc_entry = [ r'\bibtex_command "%%"' ]) + checkProg('JBibTeX, the Japanese BibTeX', ['jbibtex', 'bibtex'], + rc_entry = [ r'\jbibtex_command "%%"' ]) checkProg('an index processor', ['texindy', 'makeindex -c -q'], rc_entry = [ r'\index_command "%%"' ]) + checkProg('an index processor appropriate to Japanese', ['mendex -c -q', 'makeindex -c -q'], + rc_entry = [ r'\jindex_command "%%"' ]) checkProg('a nomenclature processor', ['makeindex'], rc_entry = [ r'\nomencl_command "makeindex -s nomencl.ist"' ]) checkProg('a spellchecker', ['ispell'], diff --git a/src/Converter.cpp b/src/Converter.cpp index 104c6582d1..7a3743bf73 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -315,6 +315,9 @@ bool Converters::convert(Buffer const * buffer, // used anyway. OutputParams runparams(buffer ? &buffer->params().encoding() : 0); runparams.flavor = getFlavor(edgepath); + + if (buffer) + runparams.use_japanese = buffer->bufferFormat() == "platex"; // Some converters (e.g. lilypond) can only output files to the // current directory, so we need to change the current directory. diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp index 236eac13d2..c3235b98f0 100644 --- a/src/LaTeX.cpp +++ b/src/LaTeX.cpp @@ -283,7 +283,7 @@ int LaTeX::run(TeXErrors & terr) LYXERR(Debug::LATEX, "Running BibTeX."); message(_("Running BibTeX.")); updateBibtexDependencies(head, bibtex_info); - rerun |= runBibTeX(bibtex_info); + rerun |= runBibTeX(bibtex_info, runparams); } else if (!had_depfile) { /// If we run pdflatex on the file after running latex on it, /// then we do not need to run bibtex, but we do need to @@ -335,7 +335,7 @@ int LaTeX::run(TeXErrors & terr) LYXERR(Debug::LATEX, "Running BibTeX."); message(_("Running BibTeX.")); updateBibtexDependencies(head, bibtex_info); - rerun |= runBibTeX(bibtex_info); + rerun |= runBibTeX(bibtex_info, runparams); } // 4 @@ -414,7 +414,9 @@ bool LaTeX::runMakeIndex(string const & f, OutputParams const & runparams, { LYXERR(Debug::LATEX, "idx file has been made, running makeindex on file " << f); - string tmp = lyxrc.index_command + ' '; + string tmp = runparams.use_japanese ? + lyxrc.jindex_command : lyxrc.index_command; + tmp += ' '; tmp = subst(tmp, "$$lang", runparams.document_language); tmp += quoteName(f); @@ -549,7 +551,8 @@ void LaTeX::updateBibtexDependencies(DepTable & dep, } -bool LaTeX::runBibTeX(vector const & bibtex_info) +bool LaTeX::runBibTeX(vector const & bibtex_info, + OutputParams const & runparams) { bool result = false; for (vector::const_iterator it = bibtex_info.begin(); @@ -558,7 +561,9 @@ bool LaTeX::runBibTeX(vector const & bibtex_info) continue; result = true; - string tmp = lyxrc.bibtex_command + " "; + string tmp = runparams.use_japanese ? + lyxrc.jbibtex_command : lyxrc.bibtex_command; + tmp += " "; // onlyFilename() is needed for cygwin tmp += quoteName(onlyFilename(removeExtension( it->aux_file.absFilename()))); diff --git a/src/LaTeX.h b/src/LaTeX.h index 251022639f..477cad222a 100644 --- a/src/LaTeX.h +++ b/src/LaTeX.h @@ -189,7 +189,7 @@ private: std::vector const &); /// - bool runBibTeX(std::vector const &); + bool runBibTeX(std::vector const &, OutputParams const &); /// void deleteFilesOnError() const; diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index 611cafb5a1..0d5a6a913b 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -1967,6 +1967,8 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_FORMAT: case LyXRC::RC_GROUP_LAYOUTS: case LyXRC::RC_INDEX_COMMAND: + case LyXRC::RC_JBIBTEX_COMMAND: + case LyXRC::RC_JINDEX_COMMAND: case LyXRC::RC_NOMENCL_COMMAND: case LyXRC::RC_INPUT: case LyXRC::RC_KBMAP: diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index 19406ea87a..e8e4314e55 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -98,6 +98,8 @@ LexerKeyword lyxrcTags[] = { { "\\gui_language", LyXRC::RC_GUI_LANGUAGE }, { "\\index_command", LyXRC::RC_INDEX_COMMAND }, { "\\input", LyXRC::RC_INPUT }, + { "\\jbibtex_command", LyXRC::RC_JBIBTEX_COMMAND }, + { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND }, { "\\kbmap", LyXRC::RC_KBMAP }, { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY }, { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY }, @@ -600,12 +602,24 @@ int LyXRC::read(Lexer & lexrc) } break; + case RC_JBIBTEX_COMMAND: + if (lexrc.next(true)) { + jbibtex_command = lexrc.getString(); + } + break; + case RC_INDEX_COMMAND: if (lexrc.next(true)) { index_command = lexrc.getString(); } break; + case RC_JINDEX_COMMAND: + if (lexrc.next(true)) { + jindex_command = lexrc.getString(); + } + break; + case RC_NOMENCL_COMMAND: if (lexrc.next(true)) { nomencl_command = lexrc.getString(); @@ -1322,6 +1336,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; + case RC_JBIBTEX_COMMAND: + if (ignore_system_lyxrc || + jbibtex_command != system_lyxrc.jbibtex_command) { + os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n"; + } + if (tag != RC_LAST) + break; case RC_INDEX_COMMAND: if (ignore_system_lyxrc || index_command != system_lyxrc.index_command) { @@ -1329,6 +1350,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; + case RC_JINDEX_COMMAND: + if (ignore_system_lyxrc || + jindex_command != system_lyxrc.jindex_command) { + os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n"; + } + if (tag != RC_LAST) + break; case RC_NOMENCL_COMMAND: if (ignore_system_lyxrc || nomencl_command != system_lyxrc.nomencl_command) { @@ -2465,6 +2493,10 @@ string const LyXRC::getDescription(LyXRCTags tag) str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus)."); break; + case RC_JBIBTEX_COMMAND: + str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX)."); + break; + case RC_BINDFILE: str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories."); break; @@ -2550,6 +2582,10 @@ string const LyXRC::getDescription(LyXRCTags tag) str = _("Define the options of makeindex (cf. man makeindex) or select an alternative compiler. E.g., using xindy/make-rules, the command string would be \"makeindex.sh -m $$lang\"."); break; + case RC_JINDEX_COMMAND: + str = _("Define the options of the index program for PLaTeX (Japanese LaTeX)."); + break; + case RC_NOMENCL_COMMAND: str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options."); break; diff --git a/src/LyXRC.h b/src/LyXRC.h index e1a9ae9a28..b138ebd5d0 100644 --- a/src/LyXRC.h +++ b/src/LyXRC.h @@ -86,6 +86,8 @@ public: RC_GROUP_LAYOUTS, RC_INDEX_COMMAND, RC_INPUT, + RC_JBIBTEX_COMMAND, + RC_JINDEX_COMMAND, RC_KBMAP, RC_KBMAP_PRIMARY, RC_KBMAP_SECONDARY, @@ -245,8 +247,12 @@ public: std::string chktex_command; /// command to run bibtex incl. options std::string bibtex_command; + /// command to run japanese bibtex incl. options + std::string jbibtex_command; /// command to run makeindex incl. options or other index programs std::string index_command; + /// command to run japanese index program incl. options + std::string jindex_command; /// command to run makeindex incl. options for nomencl std::string nomencl_command; /// diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index f530e0e801..82c1bfca03 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -595,8 +595,12 @@ PrefLatex::PrefLatex(GuiPreferences * form) this, SIGNAL(changed())); connect(latexBibtexED, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); + connect(latexJBibtexED, SIGNAL(textChanged(QString)), + this, SIGNAL(changed())); connect(latexIndexED, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); + connect(latexJIndexED, SIGNAL(textChanged(QString)), + this, SIGNAL(changed())); connect(latexAutoresetCB, SIGNAL(clicked()), this, SIGNAL(changed())); connect(latexDviPaperED, SIGNAL(textChanged(QString)), @@ -619,7 +623,9 @@ void PrefLatex::apply(LyXRC & rc) const rc.fontenc = fromqstr(latexEncodingED->text()); rc.chktex_command = fromqstr(latexChecktexED->text()); rc.bibtex_command = fromqstr(latexBibtexED->text()); + rc.jbibtex_command = fromqstr(latexJBibtexED->text()); rc.index_command = fromqstr(latexIndexED->text()); + rc.jindex_command = fromqstr(latexJIndexED->text()); rc.nomencl_command = fromqstr(latexNomenclED->text()); rc.auto_reset_options = latexAutoresetCB->isChecked(); rc.view_dvi_paper_option = fromqstr(latexDviPaperED->text()); @@ -636,7 +642,9 @@ void PrefLatex::update(LyXRC const & rc) latexEncodingED->setText(toqstr(rc.fontenc)); latexChecktexED->setText(toqstr(rc.chktex_command)); latexBibtexED->setText(toqstr(rc.bibtex_command)); + latexJBibtexED->setText(toqstr(rc.jbibtex_command)); latexIndexED->setText(toqstr(rc.index_command)); + latexJIndexED->setText(toqstr(rc.jindex_command)); latexNomenclED->setText(toqstr(rc.nomencl_command)); latexAutoresetCB->setChecked(rc.auto_reset_options); latexDviPaperED->setText(toqstr(rc.view_dvi_paper_option)); diff --git a/src/frontends/qt4/ui/PrefLatexUi.ui b/src/frontends/qt4/ui/PrefLatexUi.ui index f81fbdec87..0e24d8a14a 100644 --- a/src/frontends/qt4/ui/PrefLatexUi.ui +++ b/src/frontends/qt4/ui/PrefLatexUi.ui @@ -6,7 +6,7 @@ 0 0 427 - 359 + 367 @@ -19,87 +19,7 @@ 6 - - - - &Nomenclature command: - - - latexNomenclED - - - - - - - Command and options for nomencl (usually makeindex) - - - - - - - &Index command: - - - latexIndexED - - - - - - - Index command and options (makeindex, xindy) - - - - - - - Optional paper size flag (-paper) for some DVI viewers - - - - - - - &DVI viewer paper size options: - - - latexDviPaperED - - - - - - - true - - - - - - Select if LyX should output Windows-style paths rather than Posix-style paths to LaTeX files. Useful if you're using the native Windows MikTeX rather than the Cygwin teTeX. - - - Qt::LeftToRight - - - &Use Windows-style paths in LaTeX files - - - - - - - Set class options to default on class change - - - R&eset class options when document class changes - - - - + Qt::Vertical @@ -110,11 +30,21 @@ 409 - 20 + 21 + + + + Set class options to default on class change + + + R&eset class options when document class changes + + + @@ -178,13 +108,6 @@ - - - - BibTeX command and options - - - @@ -195,16 +118,6 @@ - - - - &BibTeX command: - - - latexBibtexED - - - @@ -232,6 +145,127 @@ + + + + BibTeX command and options + + + + + + + &BibTeX command: + + + latexBibtexED + + + + + + + &Nomenclature command: + + + latexNomenclED + + + + + + + true + + + + + + Select if LyX should output Windows-style paths rather than Posix-style paths to LaTeX files. Useful if you're using the native Windows MikTeX rather than the Cygwin teTeX. + + + Qt::LeftToRight + + + &Use Windows-style paths in LaTeX files + + + + + + + Command and options for nomencl (usually makeindex) + + + + + + + Index command and options (makeindex, xindy) + + + + + + + &Index command: + + + latexIndexED + + + + + + + Specific index command and options for pLaTeX (Japanese) + + + + + + + Specific BibTeX command and options for pLaTeX (Japanese) + + + + + + + BibTeX command (&Japanese): + + + latexJBibtexED + + + + + + + Index command (Ja&panese): + + + latexJIndexED + + + + + + + Optional paper size flag (-paper) for some DVI viewers + + + + + + + &DVI viewer paper size options: + + + latexDviPaperED + + + diff --git a/status.16x b/status.16x index 60e2736516..d77d5380fa 100644 --- a/status.16x +++ b/status.16x @@ -35,7 +35,9 @@ What's new * DOCUMENT INPUT/OUTPUT - +- Implement separate chains for Japanese bibliography and index + compilation. This allows for proper support for jbibtex and mendex, + pLaTeX's bibtex and makeindex replacements (bug 5601). * USER INTERFACE