[Tex/LaTex] How to show line (symbol) in text

symbolstext;

In latex how to show different types of line, in symbol form as —- and other forms, in text line.

enter image description here

Best Answer

With TikZ you can define your own dash and dot patterns and embed the picture inline using \tikz. As none of the macros in TikZ is e-TeX protected you have to take care of that by yourself by using \protected\def or in this case \DeclareRobustCommand.

\documentclass{article}
\pagestyle{empty}
\usepackage{mathtools,tikz,caption}
\captionsetup{labelfont=sc,labelsep=period}
\DeclareRobustCommand\sampleline[1]{%
  \tikz\draw[#1] (0,0) (0,\the\dimexpr\fontdimen22\textfont2\relax)
  -- (2em,\the\dimexpr\fontdimen22\textfont2\relax);%
}
\begin{document}
\begin{figure}
  \caption{One-dimensional Fourier spectra for Case A ($M =
    1.5$) at (\emph{a}, \emph{c}) near the wall, $1 - \lvert y \rvert =
    0.04$, and (\emph{b}, \emph{d}) at the centerline:
    \sampleline{}, $\rho$;
    \sampleline{dashed}, $u$;
    \sampleline{dotted}, $v$;
    \sampleline{dash pattern=on .7em off .2em on .2em off .2em}, $w$;
    \sampleline{dash pattern=on .7em off .2em on .05em off .2em}, $T$.
    (\emph{a}, \emph{b}) Streamwise;
    (\emph{c}, \emph{d}) spanwise.}
\end{figure}
\end{document}

enter image description here

Related Question