8

How to draw wavy line in Latex simply in the sentence line of an article paragraph.

I know there is a underline \uwave comment, but I like to have just wavy line itself, without anything above.

I am looking for something such that \uwave{...} without ....

Adam below provides an answer, but I would like to have a way to shift the underwaveline to the normal position like --- or - - -?

Please help!

1

1 Answer 1

7

You can just use \hspace inside of \uwave with the length that you want.

\documentclass{article}

\usepackage[normalem]{ulem}

\begin{document}

\uwave{\hspace{1cm}}

\end{document}

enter image description here

(Note that normalem retains the normal treatment of \emphasized text. See p. 1 of the ulem documentation.)


Edit

If you want the wavy line in the middle of the text, you can do:

A\raisebox{0.5em}{\uwave{\hspace{1cm}}}B

Which produces:

enter image description here

You could wrap it in a macro:

\newcommand{\middlewave}[1]{\raisebox{0.5em}{\uwave{\hspace{#1}}}}

And then you can do:

\middlewave{1cm}

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:

\documentclass{article}

\usepackage[normalem]{ulem}
\usepackage{mwe} % for a complete Minimal Working Example

\newcommand{\middlewave}[1]{\raisebox{0.5em}{\uwave{\hspace{#1}}}}

\begin{document}

\begin{figure}
\centering
\includegraphics[width=.48\textwidth]{example-image-a}
\caption{A\protect\middlewave{1cm}B}
\end{figure}

\end{document}

enter image description here

12
  • Thanks, is there a way to shift the underwaveline to the normal position like --- or - - -?
    – wonderich
    Commented Mar 9, 2014 at 3:35
  • 2
    You could use \raisebox{1ex}{\uwave{\hspace{1cm}}}
    – corporal
    Commented Mar 9, 2014 at 3:46
  • Looks like we had the same idea, @corporal. :)
    – Adam Liter
    Commented Mar 9, 2014 at 3:47
  • 1
    @Idear see my edit.
    – Adam Liter
    Commented Mar 9, 2014 at 3:48
  • 1
    @Idear see my update.
    – Adam Liter
    Commented Mar 9, 2014 at 4:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .