The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged

28

Declare \normalem at the appropriate point in the document body. (The correspondent macro to switch to "underlined" emphasis is \ULforem.) \documentclass{article} \usepackage{ulem} \begin{document} Some \emph{emphasised} text. \normalem Some \emph{emphasised} text. \ULforem Some \emph{emphasised} text. \end{document}


24

cancel is intended for indicating mathematic cancellation, and consequently only works in math mode; it also strikes out diagnoally. soul and ulem seem pretty similar. One basic semantic difference between them is that ulem per default changes the definition of \emph{...} to underline its argument instead of putting it in italics. This seems to aim at the ...


15

You can use the package ulem to create new styles. \documentclass[a4paper,12pt]{scrartcl} \usepackage[normalem]{ulem} \usepackage{xcolor} \makeatletter \newcommand\uuuline{\bgroup\markoverwith% {% \textcolor{red}{\rule[-0.5ex]{2pt}{0.4pt}}% \llap{\textcolor{blue}{\rule[-0.7ex]{2pt}{0.4pt}}}% \llap{\textcolor{green}{\rule[-0.9ex]{2pt}{0.4pt}...


13

Simply load ulem with the option normalem, otherwise all \emphasized words will be underlined. MWE: \documentclass{report} \usepackage{apalike} \bibliographystyle{apalike} \let\bibhang\relax \usepackage{natbib} % reference manager \usepackage[normalem]{ulem} %to strike the words \usepackage{hyperref} \usepackage{cleveref} \begin{document} This a ...


11

There is a bold variant of the lasy fonts: lasyb10. Some scaling is needed to fit the width of the character of font lasy6 (e.g., because of different design size). The example is plain TeX syntax, therefore I keep it. % plain TeX \input ulem.sty\relax \catcode`\@=11 % \font\uwavefontold=lasy6 \font\uwavefont=lasyb10 scaled 652 \def\uwaveold{% \...


10

Package ulem uses \leaders for the repeated underline elements. For example, \leaders is used in the table of contents for the dotted lines. Then the dots are vertically aligned on the page. The package file ulem.sty says in a comment: % That concludes the basic underlining. To put various other objects % (characters) under (or over) text we need to ...


10

Another solution found in the manual is to use the \usepackage option [normalem]. This is probably a better solution if you are using the package ulem just for line struck through word or some other feature, but want you use \emph as italics. I know this is not exactly your case, but may be useful for someone else.


10

Here is a solution using the SOUL package. Linebreaks etc. are respected although spacing may change very slightly if prior experience holds true. I tried with ulem but likely because of my unfamiliarity of the package, I couldn't get a solution that would work for more than a single word. I'm not sure if the SOUL package is any less compatible than ulem ...


10

The ulem source states that: To draw a line through text instead of under it (strike out) do under-line with negative depth. So, the thickness of the strike is the same as that of the underline. From the ulem package documentation: The thickness of the underline rule is given by the command macro \ULthickness; use \renewcommand (not the usual \...


10

Put the \textenglish{aaa} block inside the same \uline: \documentclass[a4paper,numbers=noenddot]{scrartcl} \usepackage{fontspec} \PassOptionsToPackage{normalem}{ulem} \usepackage{ulem} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands. \defaultfontfeatures{Scale=MatchUppercase, Ligatures=TeX} \newfontfamily\hebrewfont[Script=Hebrew]{David CLM ...


9

It is \textcolor{color}{argument} and also \uline{argument} Here you have none of the arguments so the macros are picking up whatever they can find as arguments. \documentclass[a4paper,12pt]{report} \usepackage[table,hyperref,dvipsnames]{xcolor} \usepackage{ulem} \newcommand{\coline}[1]{\subsection{\textcolor{blue!80!black}{\uline{#1}}}} \begin{document} \...


9

This is going to be very hard with biblatex because \uline can not deal with complicated macros in its argument. But due to the way biblatex works we would inevitably end up feeding extremely complicated macros to \uline. Simple things like \uline{\printtext{foo}} seem to work fine, but \uline{\printfield{title}} already broke when the title was to be ...


8

This is covered in the documentation to ulem on page 5: This loss of local assignments will break some other standard commands, (e.g., \cite) which produce multiple ‘words’ using local assignments. The way to protect such commands is to bury them in an \mbox: \emph{every\-one agrees~\mbox{\cite{you,me}}.} In your case using \mbox you get a ...


7

Box the contents in an \mbox that you then use inside equation as a macro. \documentclass{article} \usepackage{soul}% http://ctan.org/pkg/soul \newcommand{\stI}{\mbox{\st{$I$}}} \begin{document} \begin{equation} f(x)=\stI\times\stI \end{equation} \end{document} A slightly more verbatim boxing technique is to set everything inside a box using lrbox and ...


7

When ulem is loaded before amsmath and fontspec, the definition of \[ results being > \[=macro: ->\protect \[ . instead of the correct one > \[=macro: ->\x@protect \[\protect \[ . as defined by amsmath via `\DeclareRobustCommand. The problem is due to the fact that ulem defines \MakeRobust; later fontspec loads fixltx2e that does \...


7

Package ulem redefines \em/\emph. Emphasized text is no longer in italics, but the text is underlined. This can be turned off by option normalem: \usepackage[normalem]{ulem}


7

\vphantom{\psi} helps. Then the underlining command for i sees the larger descender of \psi, while \psi is not visible: \documentclass{article} \usepackage{amsmath} \usepackage[normalem]{ulem} \begin{document} %underline example \begin{align} m = -\dfrac{3}{2} z_\mathrm{p} \operatorname{Im}\{\underline{\psi}_1^{\angle k} \underline{i\vphantom{\psi}}_1^{\...


7

The definition of \em with ulem becomes \def\@tempa{\uline}% \global\let\UL@ender\UL@swender \expandafter\@tempa\expandafter{\ifnum\z@=\string`}\fi This is an interesting trick for essentially turning {\em something} into \uline{something} A consequence of this is that \em needs to see an explicit closing brace and cannot be “free”. Underlining cannot ...


7

use \mbox{} \documentclass{article} \usepackage{ulem} \begin{document} Works: \sout{Lorem ipsum dolor sit amet~\mbox{\cite{a}}} Compile error: \sout{Lorem ipsum dolor sit amet~\mbox{\cite{a,b}}} \begin{thebibliography}{99} \bibitem{a} Paper a \bibitem{b} Paper b \end{thebibliography} \end{document}


7

\underdashes and \underdots are available in ConTeXt out-of-the-box. An \underdashdots can be easily made with some MetaFun. \startuseMPgraphic{rules:under:dashdot} draw ((0,RuleDepth) -- (RuleWidth,RuleDepth)) shifted (0,RuleFactor*RuleOffset) dashed dashpattern(on RuleFactor/2 off RuleFactor/2 on RuleThickness off RuleFactor/2)...


6

You can use $\mbox{\uline{$....$}}$ if you want to underline a subterm of the math with ulem text settings.


6

This is a hack on the censor package to do that which was not intended. All things considered, not too bad. It makes space for descenders, with a user-settable gap (\maxkern)! The depth (\censorruledepth) and thickness (\censorruleheight) of the underrule are fully settable. It does linebreaking and page breaking. And with this EDITED version, it now ...


6

1. Packages At CTAN, you will find several packages that offer some sort of ‘mark changes’. Mark up changes is in my opinion one of the few places where traditional text processor like LibreOffice Writer, AbiWord or MSWord have an advantage over Latex and a text editor. Marking changes in Latex source clutter the text and make it less readable (you have to ...


6

Simply enclose the \uline{} inside a pair of braces. You do not need any other package. \documentclass{article} \usepackage[table]{xcolor} \usepackage[normalem]{ulem} \usepackage{soul} \newcommand{\bg}[2]{\sethlcolor{#1}\hl{#2}} \definecolor{ColorFg}{HTML}{FFFFFF} \definecolor{ColorBg}{HTML}{008000} \begin{document} {\color{ColorFg}\bg{ColorBg}{Some {\...


6

I found two ways. Using \usefield (biblatex.pdf, page 177) First way: Redefine bibmacro{title} The bibmacro{title} is defined in the file biblatex.def as follows: \newbibmacro*{title}{% \ifboolexpr{ test {\iffieldundef{title}} and test {\iffieldundef{subtitle}} } {} {\printtext[title]{% \printfield[titlecase]{title}% \...


6

Just do \renewcommand for \ULthickness (the default value is 0.4pt). If, additionally, you want that the strike out line is level with the hyphen, you have to modify the definition of \sout too. \documentclass{article} \usepackage{fourier} \usepackage{fontspec} \setmainfont{Erewhon}[ Extension=.otf, UprightFont=*-Regular, ItalicFont=*-Italic, ...


6

The space between the double lines is hard-coded: 1.2pt, see the definition of \uuline in package ulem. The following example changes the definition in two ways: The hard-coded space is replaced by dimen register \uulinesep. Also the top line is aligned, not the bottom line. This avoids that the top line overprints the descenders or even moves above the ...


6

As the documentation says (emphasizing by me): Several text-formatting commands are specially supported within the underlining: \-, \ , ~, \\, \newline, \linebreak, \nolinebreak, \penalty, \hskip, \hspace, \hfil, \hfill, \hss. Displayed math is not supported. The special commands do have a problem: they end a group so any local assignments ...


5

Both ulem and soul can achieve what you're after, although it seems that the latter is slightly preferred. In the following examples, texts are colored red only for illustration purposes. Changing the color to white will "hide" the texts. Code \documentclass{article} \usepackage{ulem,xcolor} \usepackage{soul} \newcommand\ulemfill{\bgroup\color{red}\...


5

Put problematic parts in a box (see the documentation). But -- as Heiko reminds in the comment -- if you put the whole footnote in the box you will loose the text. So you should use \footnotemark/\footnotetext: \documentclass{article} \usepackage{ulem} \begin{document} \uline{test\mbox{\footnotemark}}\footnotetext{note}\uline{ blalbalb}\footnote{blub} \...


Only top voted, non community-wiki answers of a minimum length are eligible