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
This commit is contained in:
Jürgen Spitzmüller 2009-06-08 16:04:11 +00:00
parent 8262926d58
commit b7304601e0
11 changed files with 208 additions and 112 deletions

View File

@ -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

View File

@ -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'],

View File

@ -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.

View File

@ -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<Aux_Info> const & bibtex_info)
bool LaTeX::runBibTeX(vector<Aux_Info> const & bibtex_info,
OutputParams const & runparams)
{
bool result = false;
for (vector<Aux_Info>::const_iterator it = bibtex_info.begin();
@ -558,7 +561,9 @@ bool LaTeX::runBibTeX(vector<Aux_Info> 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())));

View File

@ -189,7 +189,7 @@ private:
std::vector<Aux_Info> const &);
///
bool runBibTeX(std::vector<Aux_Info> const &);
bool runBibTeX(std::vector<Aux_Info> const &, OutputParams const &);
///
void deleteFilesOnError() const;

View File

@ -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:

View File

@ -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;

View File

@ -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;
///

View File

@ -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));

View File

@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>427</width>
<height>359</height>
<height>367</height>
</rect>
</property>
<property name="windowTitle" >
@ -19,87 +19,7 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="5" column="0" >
<widget class="QLabel" name="latexNomenclLA" >
<property name="text" >
<string>&amp;Nomenclature command:</string>
</property>
<property name="buddy" >
<cstring>latexNomenclED</cstring>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2" >
<widget class="QLineEdit" name="latexNomenclED" >
<property name="toolTip" >
<string>Command and options for nomencl (usually makeindex)</string>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="latexIndexLA" >
<property name="text" >
<string>&amp;Index command:</string>
</property>
<property name="buddy" >
<cstring>latexIndexED</cstring>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2" >
<widget class="QLineEdit" name="latexIndexED" >
<property name="toolTip" >
<string>Index command and options (makeindex, xindy)</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="2" >
<widget class="QLineEdit" name="latexDviPaperED" >
<property name="toolTip" >
<string>Optional paper size flag (-paper) for some DVI viewers</string>
</property>
</widget>
</item>
<item row="6" column="0" >
<widget class="QLabel" name="latexDviPaperLA" >
<property name="text" >
<string>&amp;DVI viewer paper size options:</string>
</property>
<property name="buddy" >
<cstring>latexDviPaperED</cstring>
</property>
</widget>
</item>
<item row="7" column="0" colspan="3" >
<widget class="QCheckBox" name="pathCB" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="toolTip" >
<string/>
</property>
<property name="whatsThis" >
<string>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.</string>
</property>
<property name="layoutDirection" >
<enum>Qt::LeftToRight</enum>
</property>
<property name="text" >
<string>&amp;Use Windows-style paths in LaTeX files</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="3" >
<widget class="QCheckBox" name="latexAutoresetCB" >
<property name="toolTip" >
<string>Set class options to default on class change</string>
</property>
<property name="text" >
<string>R&amp;eset class options when document class changes</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="3" >
<item row="11" column="0" colspan="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
@ -110,11 +30,21 @@
<property name="sizeHint" >
<size>
<width>409</width>
<height>20</height>
<height>21</height>
</size>
</property>
</spacer>
</item>
<item row="10" column="0" colspan="3" >
<widget class="QCheckBox" name="latexAutoresetCB" >
<property name="toolTip" >
<string>Set class options to default on class change</string>
</property>
<property name="text" >
<string>R&amp;eset class options when document class changes</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QComboBox" name="latexPaperSizeCO" >
<item>
@ -178,13 +108,6 @@
</property>
</spacer>
</item>
<item row="3" column="1" colspan="2" >
<widget class="QLineEdit" name="latexBibtexED" >
<property name="toolTip" >
<string>BibTeX command and options</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="latexChecktexLA" >
<property name="text" >
@ -195,16 +118,6 @@
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="latexBibtexLA" >
<property name="text" >
<string>&amp;BibTeX command:</string>
</property>
<property name="buddy" >
<cstring>latexBibtexED</cstring>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="QLineEdit" name="latexChecktexED" >
<property name="toolTip" >
@ -232,6 +145,127 @@
</property>
</widget>
</item>
<item row="3" column="1" colspan="2" >
<widget class="QLineEdit" name="latexBibtexED" >
<property name="toolTip" >
<string>BibTeX command and options</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="latexBibtexLA" >
<property name="text" >
<string>&amp;BibTeX command:</string>
</property>
<property name="buddy" >
<cstring>latexBibtexED</cstring>
</property>
</widget>
</item>
<item row="7" column="0" >
<widget class="QLabel" name="latexNomenclLA" >
<property name="text" >
<string>&amp;Nomenclature command:</string>
</property>
<property name="buddy" >
<cstring>latexNomenclED</cstring>
</property>
</widget>
</item>
<item row="9" column="0" colspan="3" >
<widget class="QCheckBox" name="pathCB" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="toolTip" >
<string/>
</property>
<property name="whatsThis" >
<string>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.</string>
</property>
<property name="layoutDirection" >
<enum>Qt::LeftToRight</enum>
</property>
<property name="text" >
<string>&amp;Use Windows-style paths in LaTeX files</string>
</property>
</widget>
</item>
<item row="7" column="1" colspan="2" >
<widget class="QLineEdit" name="latexNomenclED" >
<property name="toolTip" >
<string>Command and options for nomencl (usually makeindex)</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2" >
<widget class="QLineEdit" name="latexIndexED" >
<property name="toolTip" >
<string>Index command and options (makeindex, xindy)</string>
</property>
</widget>
</item>
<item row="5" column="0" >
<widget class="QLabel" name="latexIndexLA" >
<property name="text" >
<string>&amp;Index command:</string>
</property>
<property name="buddy" >
<cstring>latexIndexED</cstring>
</property>
</widget>
</item>
<item row="6" column="1" colspan="2" >
<widget class="QLineEdit" name="latexJIndexED" >
<property name="toolTip" >
<string>Specific index command and options for pLaTeX (Japanese)</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2" >
<widget class="QLineEdit" name="latexJBibtexED" >
<property name="toolTip" >
<string>Specific BibTeX command and options for pLaTeX (Japanese)</string>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="latexJBibtexLA" >
<property name="text" >
<string>BibTeX command (&amp;Japanese):</string>
</property>
<property name="buddy" >
<cstring>latexJBibtexED</cstring>
</property>
</widget>
</item>
<item row="6" column="0" >
<widget class="QLabel" name="latexJIndexLA" >
<property name="text" >
<string>Index command (Ja&amp;panese):</string>
</property>
<property name="buddy" >
<cstring>latexJIndexED</cstring>
</property>
</widget>
</item>
<item row="8" column="1" colspan="2" >
<widget class="QLineEdit" name="latexDviPaperED" >
<property name="toolTip" >
<string>Optional paper size flag (-paper) for some DVI viewers</string>
</property>
</widget>
</item>
<item row="8" column="0" >
<widget class="QLabel" name="latexDviPaperLA" >
<property name="text" >
<string>&amp;DVI viewer paper size options:</string>
</property>
<property name="buddy" >
<cstring>latexDviPaperED</cstring>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>

View File

@ -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