My goal is to include a legend in a caption in Latex. This legend would include symbols of a full line, dotted line, chain line, …
However, I would like to do this, without "messing" with the fonts of the IEEEtran document class.
My first idea was to use the pstricks package:
\documentclass[journal]{IEEEtran}
\usepackage{pstricks}
\newbox{\full}
\savebox{\full}{(
\begin{pspicture}(0,0)(0.6,0)
\psline[linewidth=0.04,linecolor=black](0,0.1)(0.6,0.1)
\end{pspicture})}
\newbox{\dotted}
\savebox{\dotted}{
(\begin{pspicture}(0,0)(0.6,0)
\psline\[linestyle=dashed,dash=1pt 2pt,linewidth=0.04,linecolor=black\](0,0.1)(0.6,0.1)
\end{pspicture})}
\newbox{\dashed}
\savebox{\dashed}{
(\begin{pspicture}(0,0)(0.6,0)
\psline\[linewidth=0.04,linecolor=black\](0,0.1)(0.15,0.1)
\psline\[linewidth=0.04,linecolor=black\](0.2,0.1)(0.4,0.1)
\psline\[linewidth=0.04,linecolor=black\](0.45,0.1)(0.6,0.1)
\end{pspicture})}
\newbox{\chain}
\savebox{\chain}{
(\begin{pspicture}(0,0)(0.6,0)
\psline\[linewidth=0.04,linecolor=black\](0,0.1)(0.15,0.1)
\psline\[linewidth=0.04,linestyle=dashed,dash=1pt 2pt,linecolor=black\](0.2,0.1)(0.4,0.1)
\psline\[linewidth=0.04,linecolor=black\](0.45,0.1)(0.6,0.1)
\end{pspicture})}
\begin{document}
\title{Title}
\author{Authors}
\maketitle
\begin{abstract}
LOREM IPSUM.
\end{abstract}
\begin{IEEEkeywords}
Keywords.
\end{IEEEkeywords}
\section{Introduction}
TEST: Dashed: \usebox{\dashed}, Chain: \usebox{\chain}, full: \usebox{\full}, dotted: \usebox{\dotted}.
\end{document}
This yields this result if compiled with xelatex:
However, the fonts of the IEEEtran document class are altered. Ideally, I would like to create these legend symbols or similar, without altering the fonts of the document class (probably only possible with the pdflatex compiler?) and I'm looking for a way to do this.
Best Answer
One possibility is to use tikz; compile with pdflatex, xelatex or lualatex.