mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 22:06:15 +00:00
Protect underlined \ref{} commands by enclosing them in \mbox{}.
This is the same protection used for \cite{}. Although "ulem" commands
don't strictly need this protection with \ref{} and friends, this helps
when one wants to use another package souch as "soul".
Indeed, ulem's \uline{} doesn't hyphenate words, while soul's \ul{} does,
and thus the output is much nicer.
With this patch, replacing ulem with soul is as simple as adding
\usepackage{soul}
\renewcommand{\uline}[1]{\ul{#1}}
to the preamble, without worrying about manually enclosing in \mbox the
\ref commands. In any case, the output from ulem remains unchanged.
Another possibility offered by soul is that of typesetting as
"yellow highlighted" the underlined text. This is achieved by adding
\usepackage{color,soul}
\renewcommand{\uline}[1]{\hl{#1}}
to the preamble.
(cherry picked from commit 91afc2430d
)
This commit is contained in:
parent
8475f73366
commit
fbaf3fc84d
@ -142,6 +142,9 @@ void InsetRef::latex(otexstream & os, OutputParams const & rp) const
|
|||||||
string const cmd = getCmdName();
|
string const cmd = getCmdName();
|
||||||
docstring const data = getEscapedLabel(rp);
|
docstring const data = getEscapedLabel(rp);
|
||||||
|
|
||||||
|
if (rp.inulemcmd)
|
||||||
|
os << "\\mbox{";
|
||||||
|
|
||||||
if (cmd == "eqref" && buffer().params().use_refstyle) {
|
if (cmd == "eqref" && buffer().params().use_refstyle) {
|
||||||
os << '(' << from_ascii("\\ref{") << data << from_ascii("})");
|
os << '(' << from_ascii("\\ref{") << data << from_ascii("})");
|
||||||
}
|
}
|
||||||
@ -159,6 +162,9 @@ void InsetRef::latex(otexstream & os, OutputParams const & rp) const
|
|||||||
p["reference"] = ref;
|
p["reference"] = ref;
|
||||||
os << p.getCommand(rp);
|
os << p.getCommand(rp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rp.inulemcmd)
|
||||||
|
os << "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,6 +32,9 @@ What's new
|
|||||||
|
|
||||||
- Add support for some IPA diacritics.
|
- Add support for some IPA diacritics.
|
||||||
|
|
||||||
|
- Enclose underlined \ref{} commands in \mbox{} to protect them when
|
||||||
|
using the package soul in place of (or together with) ulem.
|
||||||
|
|
||||||
|
|
||||||
* TEX2LYX IMPROVEMENTS
|
* TEX2LYX IMPROVEMENTS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user