pdflatex のキャプションの凡例 (点線、鎖線、破線など)

pdflatex のキャプションの凡例 (点線、鎖線、破線など)

私の目標は、Latex のキャプションに凡例を含めることです。この凡例には、実線、点線、鎖線などの記号が含まれます。ただし、IEEEtran ドキュメント クラスのフォントを「いじらずに」これを行いたいと考えています。

私の最初のアイデアは、pstricks パッケージを使用することです。

\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}

xelatex でコンパイルすると、次の結果が得られます。

ここに画像の説明を入力してください

ただし、IEEEtran ドキュメント クラスのフォントは変更されています。理想的には、ドキュメント クラスのフォントを変更せずに、これらの凡例記号などを作成したいのですが (おそらく pdflatex コンパイラでのみ可能でしょうか?)、これを実現する方法を探しています。

答え1

1 つの可能性は、tikz を使用し、pdflatex、xelatex、または lualatex でコンパイルすることです。

ここに画像の説明を入力してください

\documentclass[journal]{IEEEtran}
\usepackage{tikz}
\DeclareRobustCommand\full  {\tikz[baseline=-0.6ex]\draw[thick] (0,0)--(0.5,0);}
\DeclareRobustCommand\dotted{\tikz[baseline=-0.6ex]\draw[thick,dotted] (0,0)--(0.54,0);}
\DeclareRobustCommand\dashed{\tikz[baseline=-0.6ex]\draw[thick,dashed] (0,0)--(0.54,0);}
\DeclareRobustCommand\chain {\tikz[baseline=-0.6ex]\draw[thick,dash dot dot] (0,0)--(0.5,0);}
\begin{document}
\title{Title}
\author{Authors}
\maketitle
\begin{abstract}
LOREM IPSUM.
\end{abstract}
\begin{IEEEkeywords}
Keywords.
\end{IEEEkeywords}

\listoffigures

\section{Introduction}
TEST: Dashed (\dashed), chain (\chain), full (\full), dotted (\dotted).
\begin{figure}
\includegraphics[width=4cm]{example-image}
\caption{\full, \dashed, \chain, and \dotted}
\end{figure}
\end{document}

関連情報