(Disclaimer: It may be considered a typographically bad practice to underline text.)
I can think of two ways to do this.
ulem
This option is good if you want a fast solution. Use \dotuline
or \dashuline
from the package ulem
.
\documentclass{article}
\usepackage[normalem]{ulem} % [normalem] prevents the package from changing the default behavior of `\emph` to underline.
\begin{document}
\dotuline{dotty}
\dashuline{dashing}
\end{document}
TikZ
This option is good if you want control. You can create your own macro with TikZ. The following is an example of six macros. The first three produces dotted underlining and the last three dashed underlining.
\documentclass{article}
\usepackage{tikz}
\newcommand{\udot}[1]{%
\tikz[baseline=(todotted.base)]{
\node[inner sep=1pt,outer sep=0pt] (todotted) {#1};
\draw[dotted] (todotted.south west) -- (todotted.south east);
}%
}%
\newcommand{\udensdot}[1]{%
\tikz[baseline=(todotted.base)]{
\node[inner sep=1pt,outer sep=0pt] (todotted) {#1};
\draw[densely dotted] (todotted.south west) -- (todotted.south east);
}%
}%
\newcommand{\uloosdot}[1]{%
\tikz[baseline=(todotted.base)]{
\node[inner sep=1pt,outer sep=0pt] (todotted) {#1};
\draw[loosely dotted] (todotted.south west) -- (todotted.south east);
}%
}%
\newcommand{\udash}[1]{%
\tikz[baseline=(todotted.base)]{
\node[inner sep=1pt,outer sep=0pt] (todotted) {#1};
\draw[dashed] (todotted.south west) -- (todotted.south east);
}%
}%
\newcommand{\udensdash}[1]{%
\tikz[baseline=(todotted.base)]{
\node[inner sep=1pt,outer sep=0pt] (todotted) {#1};
\draw[densely dashed] (todotted.south west) -- (todotted.south east);
}%
}%
\newcommand{\uloosdash}[1]{%
\tikz[baseline=(todotted.base)]{
\node[inner sep=1pt,outer sep=0pt] (todotted) {#1};
\draw[loosely dashed] (todotted.south west) -- (todotted.south east);
}%
}%
\begin{document}
\uloosdot{dotty}
\udot{dotty}
\udensdot{dotty}
\uloosdash{dashing}
\udash{dashing}
\udensdash{dashing}
\end{document}
Note that you can modify these macros to fit your needs. For example you can change the thickness styles by adding thick
as an option to \draw
, e.g.
\draw[dotted, thick] (todotted.south west) -- (todotted.south east);
Other modification might be to change the color and opacity, e.g.
\draw[dotted, blue, opacity=0.25] (todotted.south west) -- (todotted.south east);
or to change the distance between the text and the decoration by editing the measures in [inner sep=1pt,outer sep=0pt]
, e.g.
\node[inner sep=0.8pt,outer sep=0pt] (todotted) {#1};
All TikZ code in this answer is a simple modification of \cancel draws under thing being canceled
Use the picture environment described in section 5.2 of the Not So Short Introduction to LaTeX. Use a \put
command to position your figure, and another \put
command to position the comment.
\documentclass{article}
\begin{document}
\begin{picture}(200,200)
\put(0,0){\framebox{\phantom{\rule{200pt}{200pt}}}} %Dummy box in place of an image.
\put(150,50){\hbox{Over here}}
\end{picture}
\end{document}
Best Answer
You can just use
\hspace
inside of\uwave
with the length that you want.(Note that
normalem
retains the normal treatment of\emph
asized text. See p. 1 of theulem
documentation.)Edit
If you want the wavy line in the middle of the text, you can do:
Which produces:
You could wrap it in a macro:
And then you can do:
Edit 2
If you want to use this inside of
\caption
, you will need to\protect
it. (See What is the difference between Fragile and Robust commands?) Here's a complete MWE: