diff --git a/development/FORMAT b/development/FORMAT index 4b782d5406..00c5cfbd2d 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -7,6 +7,10 @@ changes happened in particular if possible. A good example would be ----------------------- +2020-01-10 Jürgen Spitzmüller + * Format incremented to 591: Add buffer param \postpone_fragile_content + (option to disable the mobement of labels and stuff of moving arguments). + 2019-12-24 Jürgen Spitzmüller * Format incremented to 590: Add native changebar solution via buffer param \change_bars. diff --git a/lib/doc/UserGuide.lyx b/lib/doc/UserGuide.lyx index 6f821643d0..a514d0c21c 100644 --- a/lib/doc/UserGuide.lyx +++ b/lib/doc/UserGuide.lyx @@ -1,5 +1,5 @@ #LyX 2.4 created this file. For more info see https://www.lyx.org/ -\lyxformat 590 +\lyxformat 591 \begin_document \begin_header \save_transient_properties true @@ -150,6 +150,7 @@ logicalmkup \tracking_changes true \output_changes false \change_bars false +\postpone_fragile_content false \html_math_output 0 \html_css_as_file 0 \html_be_strict true @@ -47725,25 +47726,105 @@ reference "sec:File-Formats" \end_layout \begin_layout Description + +\change_inserted -712698321 1578647276 +Allow +\begin_inset space ~ +\end_inset + +running +\begin_inset space ~ +\end_inset + +external +\begin_inset space ~ +\end_inset + +programs If this is switched on, \SpecialChar LaTeX + is run with the +\family typewriter +-shell-escape +\family default + option which is needed with some packages. + Note that this comes with security risks, so please use this only when + really necessary and if you know what you are doing. +\end_layout + +\begin_layout Description + +\change_inserted -712698321 1578647006 +LaTeX +\begin_inset space ~ +\end_inset + +Output +\begin_inset space ~ +\end_inset + +Options offers settings for the +\family sans +LaTeX +\family default + export. +\end_layout + +\begin_deeper +\begin_layout Itemize + +\family sans Synchronize +\change_inserted -712698321 1578646679 + +\change_deleted -712698321 1578646679 + \begin_inset space ~ \end_inset + +\change_unchanged with +\change_deleted -712698321 1578646686 + \begin_inset space ~ \end_inset -Output settings for the menu + +\change_inserted -712698321 1578646686 + +\change_unchanged +Output +\family default + +\change_inserted -712698321 1578646719 +enables +\change_deleted -712698321 1578646729 +settings for the menu \family sans Navigate\SpecialChar menuseparator + +\change_unchanged Forward \begin_inset space ~ \end_inset search +\change_inserted -712698321 1578646752 + \family default + and allows to customize the macro used in this process +\change_deleted -712698321 1578646757 . - For a detailed description see section + +\change_unchanged + +\change_inserted -712698321 1578646759 +( +\change_deleted -712698321 1578646759 +F +\change_inserted -712698321 1578646759 +f +\change_unchanged +or a detailed description see section \emph on Reverse DVI/PDF search \emph default @@ -47755,9 +47836,55 @@ Additional Features \emph default - manual. + manual +\change_inserted -712698321 1578646762 +) +\change_unchanged +. +\change_inserted -712698321 1578647009 + \end_layout +\begin_layout Itemize + +\change_inserted -712698321 1578647929 + +\family sans +Put fragile content out of moving arguments +\family default + determines whether so-called +\begin_inset Quotes els +\end_inset + +fragile +\begin_inset Quotes ers +\end_inset + + \SpecialChar LaTeX + constructs (such as labels or index entries) are placed outside of so-called + +\begin_inset Quotes els +\end_inset + +moving arguments +\begin_inset Quotes ers +\end_inset + + in \SpecialChar LaTeX + (such as sections or captions), even if the corresponding insets are + placed in such context in \SpecialChar LyX +. + This setting is on by default, since it prevents nasty \SpecialChar LaTeX + errors. + If you rely on labels or index entries being kept inside the problematic + macros, you can uncheck this. + If you don't know what we are talking about here, worry not: just leave + it checked. +\change_unchanged + +\end_layout + +\end_deeper \begin_layout Description XHTML \begin_inset space ~ diff --git a/lib/doc/de/UserGuide.lyx b/lib/doc/de/UserGuide.lyx index e34f4f1dc5..960dba37e7 100644 --- a/lib/doc/de/UserGuide.lyx +++ b/lib/doc/de/UserGuide.lyx @@ -1,5 +1,5 @@ #LyX 2.4 created this file. For more info see https://www.lyx.org/ -\lyxformat 590 +\lyxformat 591 \begin_document \begin_header \save_transient_properties true @@ -155,6 +155,7 @@ logicalmkup \tracking_changes false \output_changes false \change_bars false +\postpone_fragile_content false \html_math_output 0 \html_css_as_file 0 \html_be_strict false @@ -45050,6 +45051,106 @@ reference "sec:Dateiformate" . \end_layout +\begin_layout Description +Erlaube +\begin_inset space ~ +\end_inset + +den +\begin_inset space ~ +\end_inset + +Aufruf +\begin_inset space ~ +\end_inset + +externer +\begin_inset space ~ +\end_inset + +Programme Wenn dies aktiviert ist, wird \SpecialChar LaTeX + mit der Option +\family typewriter +-shell-escape +\family default + ausgeführt. + Dies ist zur Nutzung mancher Pakete nötig. + Beachten Sie, dass dies Sicherheitsrisiken birgt! Aktivieren Sie dies also + nur wenn unbedingt nötig und Sie absolut sicher sind, was Sie tun. +\end_layout + +\begin_layout Description +LaTeX-Ausgabe-Optionen bietet Einstellmöglichkeiten für den +\family sans +LaTeX +\family default +-Export. +\end_layout + +\begin_deeper +\begin_layout Itemize + +\family sans +Mit der Ausgabe synchronisieren +\family default + aktiviert die +\family sans +Vorwärtssuche +\family default + und ermöglicht die Anpassung der dabei verwendeten Makros. + Siehe Abschnitt +\emph on +DVI/PDF Rückwärtssuche +\emph default + der +\emph on +Handbuchergänzungen +\emph default + für eine detaillierte Beschreibung. +\end_layout + +\begin_layout Itemize + +\family sans +Zerbrechlichen Inhalt aus beweglichen Argumenten verschieben +\family default + bestimmt, ob so genannte +\begin_inset Quotes gls +\end_inset + +zerbrechliche +\begin_inset Quotes grs +\end_inset + + \SpecialChar LaTeX +-Konstrukte (z. +\begin_inset space \thinspace{} +\end_inset + +B. + Marken oder Stichworteinträge) in der \SpecialChar LaTeX +-Ausgabe außerhalb von so genannten + +\begin_inset Quotes gls +\end_inset + +beweglichen Argumenten +\begin_inset Quotes grs +\end_inset + + (wie Legenden oder Überschriften) gesetzt werden, auch wenn die entsprechenden + Einfügungen in \SpecialChar LyX + in dieses Umfeld platziert werden. + Diese Einstellung ist per Voreinstellung aktiviert, da sie unangenehme + \SpecialChar LaTeX +-Fehler verhindert. + Falls Sie darauf angewiesen sind, dass Marken oder Stichworteinträge innerhalb + der problematischen Umgebungen verbleiben, können Sie dies deaktivieren. + Falls Sie keine Ahnung haben, wovon wir hier überhaupt reden, kein Problem: + Lassen Sie es einfach aktiviert. +\end_layout + +\end_deeper \begin_layout Description Mit \begin_inset space ~ diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py index 5d59e34062..daae36bf06 100644 --- a/lib/lyx2lyx/lyx_2_4.py +++ b/lib/lyx2lyx/lyx_2_4.py @@ -3668,6 +3668,28 @@ def revert_changebars(document): del document.header[i] +def convert_postpone_fragile(document): + " Adds false \\postpone_fragile_content buffer param " + + i = find_token(document.header, "\\output_changes", 0) + if i == -1: + document.warning("Malformed LyX document! Missing \\output_changes header.") + return + # Set this to false for old documents (see #2154) + document.header.insert(i, "\\postpone_fragile_content false") + + +def revert_postpone_fragile(document): + " Remove \\postpone_fragile_content buffer param " + + i = find_token(document.header, "\\postpone_fragile_content", 0) + if i == -1: + document.warning("Malformed LyX document! Missing \\postpone_fragile_content.") + return + + del document.header[i] + + ## # Conversion hub # @@ -3719,10 +3741,12 @@ convert = [ [587, [convert_pagesizenames]], [588, []], [589, [convert_totalheight]], - [590, [convert_changebars]] + [590, [convert_changebars]], + [591, [convert_postpone_fragile]] ] -revert = [[589, [revert_changebars]], +revert = [[590, [revert_postpone_fragile]], + [589, [revert_changebars]], [588, [revert_totalheight]], [587, [revert_memoir_endnotes,revert_enotez,revert_theendnotes]], [586, [revert_pagesizenames]], diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 399faa3933..b1cedda6fa 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -411,6 +411,7 @@ BufferParams::BufferParams() track_changes = false; output_changes = false; change_bars = false; + postpone_fragile_content = true; use_default_options = true; maintain_unincluded_children = false; secnumdepth = 3; @@ -954,6 +955,8 @@ string BufferParams::readToken(Lexer & lex, string const & token, lex >> output_changes; } else if (token == "\\change_bars") { lex >> change_bars; + } else if (token == "\\postpone_fragile_content") { + lex >> postpone_fragile_content; } else if (token == "\\branch") { lex.eatLine(); docstring branch = lex.getDocString(); @@ -1475,6 +1478,8 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const << (save_transient_properties ? convert(change_bars) : "false") << '\n'; + os << "\\postpone_fragile_content " << convert(postpone_fragile_content) << '\n'; + os << "\\html_math_output " << html_math_output << '\n' << "\\html_css_as_file " << html_css_as_file << '\n' << "\\html_be_strict " << convert(html_be_strict) << '\n'; diff --git a/src/BufferParams.h b/src/BufferParams.h index 5b5a16f67f..c66dd6185a 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -437,6 +437,8 @@ public: bool change_bars; /// bool compressed; + /// + bool postpone_fragile_content; /// the author list for the document AuthorList & authors(); diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp index f9f3e356dd..d08a648375 100644 --- a/src/frontends/qt/GuiDocument.cpp +++ b/src/frontends/qt/GuiDocument.cpp @@ -913,8 +913,8 @@ GuiDocument::GuiDocument(GuiView & lv) connect(outputModule->shellescapeCB, SIGNAL(stateChanged(int)), this, SLOT(shellescapeChanged())); - connect(outputModule->outputsyncCB, SIGNAL(clicked()), - this, SLOT(change_adaptor())); + connect(outputModule->outputsyncCB, SIGNAL(toggled(bool)), + this, SLOT(setOutputSync(bool))); connect(outputModule->synccustomCB, SIGNAL(editTextChanged(QString)), this, SLOT(change_adaptor())); outputModule->synccustomCB->addItem(""); @@ -926,7 +926,9 @@ GuiDocument::GuiDocument(GuiView & lv) outputModule->synccustomCB)); connect(outputModule->saveTransientPropertiesCB, SIGNAL(clicked()), - this, SLOT(change_adaptor())); + this, SLOT(change_adaptor())); + connect(outputModule->postponeFragileCB, SIGNAL(clicked()), + this, SLOT(change_adaptor())); // language & quote @@ -3682,6 +3684,8 @@ void GuiDocument::applyView() bp_.save_transient_properties = outputModule->saveTransientPropertiesCB->isChecked(); + bp_.postpone_fragile_content = + outputModule->postponeFragileCB->isChecked(); // fonts bp_.fonts_roman[nontexfonts] = @@ -4313,6 +4317,8 @@ void GuiDocument::paramsToDialog() outputModule->shellescapeCB->setChecked(bp_.shell_escape); outputModule->outputsyncCB->setChecked(bp_.output_sync); outputModule->synccustomCB->setEditText(toqstr(bp_.output_sync_macro)); + outputModule->synccustomCB->setEnabled(bp_.output_sync); + outputModule->synccustomLA->setEnabled(bp_.output_sync); outputModule->mathimgSB->setValue(bp_.html_math_img_scale); outputModule->mathoutCB->setCurrentIndex(bp_.html_math_output); @@ -4321,6 +4327,8 @@ void GuiDocument::paramsToDialog() outputModule->saveTransientPropertiesCB ->setChecked(bp_.save_transient_properties); + outputModule->postponeFragileCB + ->setChecked(bp_.postpone_fragile_content); // paper bool const extern_geometry = @@ -5154,6 +5162,13 @@ void GuiDocument::outputChangesToggled(bool on) change_adaptor(); } +void GuiDocument::setOutputSync(bool on) +{ + outputModule->synccustomCB->setEnabled(on); + outputModule->synccustomLA->setEnabled(on); + change_adaptor(); +} + Dialog * createGuiDocument(GuiView & lv) { return new GuiDocument(lv); } diff --git a/src/frontends/qt/GuiDocument.h b/src/frontends/qt/GuiDocument.h index 2d0f7eaa73..3e9aa7ce5d 100644 --- a/src/frontends/qt/GuiDocument.h +++ b/src/frontends/qt/GuiDocument.h @@ -165,6 +165,7 @@ private Q_SLOTS: void resetModuleFilter(); void linenoToggled(bool); void outputChangesToggled(bool); + void setOutputSync(bool); private: /// validate listings parameters and return an error message, if any QString validateListingsParameters(); diff --git a/src/frontends/qt/ui/OutputUi.ui b/src/frontends/qt/ui/OutputUi.ui index 0691697239..b828e2304a 100644 --- a/src/frontends/qt/ui/OutputUi.ui +++ b/src/frontends/qt/ui/OutputUi.ui @@ -6,14 +6,14 @@ 0 0 - 388 - 413 + 510 + 504 Form - + @@ -22,7 +22,7 @@ true - + 9 @@ -75,36 +75,24 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + - - - - LyX Format - - - true - - - false - - - - - - Save all parameters in the LyX file, including ones that are frequently switched or that are specific to the user (such as the output of the tracked changes, or the document directory path). Disabling this option plays nicer in collaborative settings and with version control systems. - - - Save &transient properties - - - - - - @@ -115,51 +103,6 @@ - - - - Enable forward/reverse search between editor and output (e.g., SyncTeX) - - - S&ynchronize with output - - - true - - - true - - - false - - - - - - - - C&ustom macro: - - - synccustomCB - - - - - - - Custom LaTeX preamble macro - - - true - - - - - - - - @@ -169,32 +112,6 @@ true - - - - Whether to comply strictly with XHTML 1.1. - - - &Strict XHTML 1.1 - - - - - - - - 50 - false - - - - &Math output: - - - mathoutCB - - - @@ -228,6 +145,29 @@ + + + + Write CSS to file + + + + + + + + 50 + false + + + + &Math output: + + + mathoutCB + + + @@ -244,6 +184,16 @@ + + + + Whether to comply strictly with XHTML 1.1. + + + &Strict XHTML 1.1 + + + @@ -269,17 +219,48 @@ - - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + LyX Format + + + true + + + false + + + + + + Save all parameters in the LyX file, including ones that are frequently switched or that are specific to the user (such as the output of the tracked changes, or the document directory path). Disabling this option plays nicer in collaborative settings and with version control systems. + - Write CSS to file + Save &transient properties - + Qt::Vertical @@ -292,6 +273,92 @@ + + + + LaTeX Output Options + + + + + + + + Enable forward/reverse search between editor and output (e.g., SyncTeX) + + + S&ynchronize with output + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + + C&ustom macro: + + + synccustomCB + + + + + + + Custom LaTeX preamble macro + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + If this is checked, fragile items such as labels and index entries are moved out of moving arguments such as sections and captions. This prevents LaTeX errors that can happen in such cases. It is recommended to keep this on. + + + Put fra&gile content out of moving arguments + + + + + + diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp index fcd0334306..919ecd8f6d 100644 --- a/src/insets/InsetCaption.cpp +++ b/src/insets/InsetCaption.cpp @@ -260,7 +260,7 @@ void InsetCaption::latex(otexstream & os, OutputParams runparams = runparams_in; // Some fragile commands (labels, index entries) // are output after the caption (#2154) - runparams.postpone_fragile_stuff = true; + runparams.postpone_fragile_stuff = buffer().masterParams().postpone_fragile_content; InsetText::latex(os, runparams); if (!runparams.post_macro.empty()) { // Output the stored fragile commands (labels, indices etc.) diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 4befb3cb6d..8a6ed8f4e5 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -818,7 +818,8 @@ void TeXOnePar(Buffer const & buf, // Due to the moving argument, some fragile // commands (labels, index entries) // are output after this command (#2154) - runparams.postpone_fragile_stuff = true; + runparams.postpone_fragile_stuff = + bparams.postpone_fragile_content; if (intitle_command) os << '{'; @@ -932,7 +933,8 @@ void TeXOnePar(Buffer const & buf, // Due to the moving argument, some fragile // commands (labels, index entries) // are output after this command (#2154) - runparams.postpone_fragile_stuff = true; + runparams.postpone_fragile_stuff = + bparams.postpone_fragile_content; os << '{'; } @@ -1149,7 +1151,8 @@ void TeXOnePar(Buffer const & buf, // Due to the moving argument, some fragile // commands (labels, index entries) // are output after this command (#2154) - runparams.postpone_fragile_stuff = true; + runparams.postpone_fragile_stuff = + bparams.postpone_fragile_content; } Font const outerfont = text.outerFont(pit); diff --git a/src/version.h b/src/version.h index ee529fc313..8d5c2129d5 100644 --- a/src/version.h +++ b/src/version.h @@ -32,8 +32,8 @@ extern char const * const lyx_version_info; // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -#define LYX_FORMAT_LYX 590 // spitz: changebars -#define LYX_FORMAT_TEX2LYX 590 +#define LYX_FORMAT_LYX 591 // spitz: postpone_fragile_content +#define LYX_FORMAT_TEX2LYX 591 #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX #ifndef _MSC_VER