Ever wondered how to get lines in the text of your figure captions to match the lines in your plots, e.g.
Well the good news is it’s not hard at all. Simply include the package tikz, which should be part of most standard LaTeX builds, then define a command to represent the type of line you wish to use. The following code shows an example of the sorts of lines that can be produced and then placed in the text of your document using your newly defined commands.
An example of the lines that can be created and the corresponding LaTeX code is shown below.
\documentclass{report}
\usepackage{color}
\usepackage{tikz}
%
\begin{document}
\newcommand{\greenline}{\raisebox{2pt}{\tikz{\draw[-,black!40!green,solid,line width = 0.9pt](0,0) -- (5mm,0);}}}
\newcommand{\redline}{\raisebox{2pt}{\tikz{\draw[-,red,dashed,line width = 1.5pt](0,0) -- (10mm,0);}}}
\newcommand{\bluearrow}{\raisebox{2pt}{\tikz{\draw[->,blue,solid,line width = 1.5pt](0,0) -- (5mm,0);}}}
\newcommand{\rectangle}{\raisebox{0pt}{\tikz{\draw[black,solid,line width = 1.0pt](2.mm,0) rectangle (3.5mm,1.5mm);\draw[-,black,solid,line width = 1.0pt](0.,0.8mm) -- (5.5mm,0.8mm)}}}
This is a green solid line \greenline ;\\
This is a red dashed line \redline ;\\
This is a blue arrow line \bluearrow ;\\
This is a black rectangle with a line through it \rectangle ;\\
\begin{figure}[h]
\caption{This is a green line in a figure caption (\protect\greenline).}
\end{figure}
\end{document}
In the above example the raise box command is used to offset the line object so that the origin at (0.0,0.0) is inline with the text. The basic structure of the tikz draw command consists of specifying the line – or arrow -> <-; specifying the colour via name or in the case of the green line a 40% combination of black and green; the line width; then finally the first and last point along the line. As shown in the final example these lines can also be combined with other tikz elements like, rectangles, circles etc. to build up multiple types of line and symbol combinations that might be present in your plots.
Note: in order to use these commands in figure caption it is necessary to preface your defined commands with \protect to ensure LaTeX interprets the command properly.
Line functionality is only a very small part of the tikz package. For further possibilities please see https://en.wikibooks.org/wiki/LaTeX/PGF/TikZ.