1

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

enter image description here

  • \tikz\draw[...] ...;? – Henri Menke Nov 30 '15 at 8:16
3

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

| improve this answer | |
1

You can play around with some \rules:

enter image description here

\documentclass{article}
\usepackage{xhfill}

\begin{document}

One-dimensional Fourier spectra for Case~A ($M = 1.5$) at $(a,c)$ near the wall,
$1 - |y| = 0.04$, and $(b,d)$ at the centerline:
  \rule[.5ex]{2em}{.4pt},~$p$;
  \makebox[2em]{\xdotfill{.4pt}},~$u$;
  $\cdot\,\cdot\,\cdot\,\cdot\,\cdot$,~$v$;
  \rule[.5ex]{1em}{.4pt}\,\rule[.5ex]{.2em}{.4pt}\,\rule[.5ex]{1em}{.4pt},~$w$;
  \rule[.5ex]{1em}{.4pt}\,$\cdot$\,\rule[.5ex]{1em}{.4pt},~$T$.
$(a,b)$ Streamwise;
$(c,d)$ spanwise.

\end{document}

Note that \leaders and \rules have problems surviving \captions, so you may be forced to use the optional argument if you want alternative content to migrate successfully to the LoF/LoT.

| improve this answer | |
  • I think the line corresponding to u should be dashed, rather than loosely dotted. Also a,b,c, and d are presumably labels for subfigures, i.e. no math variables. – Henri Menke Nov 30 '15 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.