On Thu, Aug 30, 2012 at 02:29:49PM +0200, Enrico Forestieri wrote:
> The branch, master, has been updated.
> 
> - Log -----------------------------------------------------------------
> 
> commit 91afc2430d056e5cbf0065ac0d1a754a2a2ff384
> Author: Enrico Forestieri <for...@lyx.org>
> Date:   Thu Aug 30 14:09:23 2012 +0200
> 
>     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.

Richard, can this be applied to branch, as well?

> diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp
> index ef96101..bae4992 100644
> --- a/src/insets/InsetRef.cpp
> +++ b/src/insets/InsetRef.cpp
> @@ -142,6 +142,9 @@ void InsetRef::latex(otexstream & os, OutputParams const 
> & rp) const
>       string const cmd = getCmdName();
>       docstring const data = getEscapedLabel(rp);
>  
> +     if (rp.inulemcmd)
> +             os << "\\mbox{";
> +
>       if (cmd == "eqref" && buffer().params().use_refstyle) {
>               // we advertise this as printing "(n)", so we'll do that, at 
> least
>               // for refstyle, since refstlye's own \eqref prints, by default,
> @@ -163,6 +166,9 @@ void InsetRef::latex(otexstream & os, OutputParams const 
> & rp) const
>               p["reference"] = ref;
>               os << p.getCommand(rp);
>       }
> +
> +     if (rp.inulemcmd)
> +             os << "}";
>  }
>  
>  
> 
> -----------------------------------------------------------------------
> 
> Summary of changes:
>  src/insets/InsetRef.cpp |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> 
> hooks/post-receive
> -- 
> The LyX Source Repository

-- 
Enrico

Reply via email to