diff --git a/lib/doc/Customization.lyx b/lib/doc/Customization.lyx index e034ea0aa1..6d06e09c12 100644 --- a/lib/doc/Customization.lyx +++ b/lib/doc/Customization.lyx @@ -10748,7 +10748,7 @@ status collapsed \begin_layout Itemize -\change_inserted -712698321 1354263106 +\change_inserted -712698321 1355144479 \begin_inset Flex Code status collapsed @@ -10810,6 +10810,39 @@ status collapsed \end_inset . +\end_layout + +\begin_layout Itemize + +\change_inserted -712698321 1355144578 +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted -712698321 1355144487 +PresetArg +\change_unchanged + +\end_layout + +\end_inset + + +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted -712698321 1355144500 +[string] +\end_layout + +\end_inset + + defines an argument that is inserted in any case (alone or in addition + to user-specified arguments). + Multiple arguments need to be separated by comma. \change_unchanged \end_layout @@ -12494,7 +12527,42 @@ LatexName \end_inset stuff. - This parameter cannot be changed from within LyX. + This parameter cannot be changed from within LyX +\change_inserted -712698321 1355144804 + (use +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted -712698321 1355144804 +Argument +\end_layout + +\end_inset + + for customizable parameters) +\change_unchanged +. + +\change_inserted -712698321 1355144804 + This will be output as is after all LaTeX +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted -712698321 1355144658 +Arguments +\change_unchanged + +\end_layout + +\end_inset + +. +\change_unchanged + \end_layout \begin_layout Description @@ -16636,7 +16704,40 @@ status collapsed \end_inset . - This parameter cannot be changed from within LyX. + +\change_inserted -712698321 1355144715 +This will be output as is after all LaTeX +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted -712698321 1355144713 +Arguments +\end_layout + +\end_inset + +. + +\change_unchanged +This parameter cannot be changed from within LyX +\change_inserted -712698321 1355144775 + (use +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted -712698321 1355144747 +Argument +\end_layout + +\end_inset + + for customizable parameters) +\change_unchanged +. \end_layout \begin_layout Description diff --git a/src/Layout.cpp b/src/Layout.cpp index 1c8aac8ad4..e53e99171b 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -916,6 +916,9 @@ void Layout::readArgument(Lexer & lex) arg.rdelim = lex.getDocString(); arg.rdelim = support::subst(arg.rdelim, from_ascii("
"), from_ascii("\n")); + } else if (tok == "presetarg") { + lex.next(); + arg.presetarg = lex.getDocString(); } else if (tok == "tooltip") { lex.next(); arg.tooltip = lex.getDocString(); diff --git a/src/Layout.h b/src/Layout.h index 9b3ff388a6..a76dca6e89 100644 --- a/src/Layout.h +++ b/src/Layout.h @@ -94,6 +94,7 @@ public: bool mandatory; docstring ldelim; docstring rdelim; + docstring presetarg; docstring tooltip; std::string requires; std::string decoration; diff --git a/src/insets/InsetArgument.cpp b/src/insets/InsetArgument.cpp index 4b57f5515b..9081a96ae6 100644 --- a/src/insets/InsetArgument.cpp +++ b/src/insets/InsetArgument.cpp @@ -239,7 +239,7 @@ InsetLayout::InsetDecoration InsetArgument::decoration() const void InsetArgument::latexArgument(otexstream & os, OutputParams const & runparams_in, docstring const & ldelim, - docstring const & rdelim) const + docstring const & rdelim, docstring const & presetarg) const { TexRow texrow; odocstringstream ss; @@ -247,6 +247,9 @@ void InsetArgument::latexArgument(otexstream & os, OutputParams runparams = runparams_in; InsetText::latex(ots, runparams); docstring str = ss.str(); + docstring const sep = str.empty() ? docstring() : from_ascii(", "); + if (!presetarg.empty()) + str = presetarg + sep + str; if (ldelim != "{" && support::contains(str, rdelim)) str = '{' + str + '}'; os << ldelim << str << rdelim; diff --git a/src/insets/InsetArgument.h b/src/insets/InsetArgument.h index 1b5050db95..7ba81e37d9 100644 --- a/src/insets/InsetArgument.h +++ b/src/insets/InsetArgument.h @@ -31,7 +31,8 @@ public: /// Outputting the parameter of a LaTeX command void latexArgument(otexstream &, OutputParams const &, - docstring const&, docstring const &) const; + docstring const&, docstring const &, + docstring const &) const; std::string name() const { return name_; } diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp index afbc4db50b..3fee6fb009 100644 --- a/src/insets/InsetLayout.cpp +++ b/src/insets/InsetLayout.cpp @@ -544,6 +544,9 @@ void InsetLayout::readArgument(Lexer & lex) arg.rdelim = lex.getDocString(); arg.rdelim = support::subst(arg.rdelim, from_ascii("
"), from_ascii("\n")); + } else if (tok == "presetarg") { + lex.next(); + arg.presetarg = lex.getDocString(); } else if (tok == "tooltip") { lex.next(); arg.tooltip = lex.getDocString(); diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 9d609eea9c..1ddb4c3caa 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -368,7 +368,7 @@ void latexArgInsets(Paragraph const & par, otexstream & os, ldelim = arg.ldelim; if (!arg.rdelim.empty()) rdelim = arg.rdelim; - ins->latexArgument(os, runparams, ldelim, rdelim); + ins->latexArgument(os, runparams, ldelim, rdelim, arg.presetarg); inserted = true; } } @@ -385,7 +385,17 @@ void latexArgInsets(Paragraph const & par, otexstream & os, from_ascii("{") : arg.ldelim; docstring rdelim = arg.rdelim.empty() ? from_ascii("}") : arg.rdelim; - os << ldelim << rdelim; + os << ldelim << arg.presetarg << rdelim; + } else if (!arg.presetarg.empty()) { + docstring ldelim = arg.mandatory ? + from_ascii("{") : from_ascii("["); + docstring rdelim = arg.mandatory ? + from_ascii("}") : from_ascii("]"); + if (!arg.ldelim.empty()) + ldelim = arg.ldelim; + if (!arg.rdelim.empty()) + rdelim = arg.rdelim; + os << ldelim << arg.presetarg << rdelim; } else if (find(required.begin(), required.end(), (*lait).first) != required.end()) { docstring ldelim = arg.ldelim.empty() ?