I would like to draw horizontal rules in the caption text of graph figures, with different colors and thicknesses. The command
Code: Select all
\rule[0.5ex]{1cm}{2pt}
does not work inside the caption. I have another solution:
Code: Select all
{\color{red}--\!\!--\!\!--\!\!--\!\!--\!\!--\!\!--\!\!--\,}
Code: Select all
\documentclass[a4paper,12pt,oneside]{article}
\usepackage{caption}
\usepackage[final]{pdfpages}
\usepackage{graphicx} %,amssymb,amsmath,mathrsfs}
\usepackage{amsmath}
\begin{document}
\begin{figure}[ht]
blablabla
\label{fig:this_figure}
\caption{Red line: {\color{red}--\!\!--\!\!--\!\!--\!\!--\!\!--\!\!--\!\!--\,}, and black blue line: --\!\!--\!\!--\!\!--\!\!--\!\!--\!\!--\!\!--\,.}
\end{figure}
\verb|{\color{red}--\!\!--\!\!--\!\!--\!\!--\!\!--\!\!--\!\!--\,}|\\
is not a very elegant way to draw a rule {\color{red}--\!\!--\!\!--\!\!--\!\!--\!\!--\!\!--\!\!--\,}, but this is impossible to put a rule $\rule[0.5ex]{1cm}{2pt}$ like this inside the caption text.:\\
\verb|\rule[0.5ex]{0.75cm}{0.5pt}|
\end{document}
Thanks !
mélanie