
私のコースでは、円で示されたレベルを使用して各サブパートのレベルを指定したいと思います。
コマンドを使用すると\section{title} \trf
、タイトルの下に丸で囲まれた文字が表示されます。
\section{XX}コマンド内に次のように記述すると\section{title \trf}
、ドキュメントはコンパイルされません。
\documentclass{article}
\usepackage{tikz}
\newcommand{\atrf}{\tikz[baseline=(letter.base)]\node[draw,circle,inner sep=1pt, shade,shading=ball,circle,ball color=black!10!red] (letter) {ATRF};}
\newcommand{\trf}{\tikz[baseline=(letter.base)]\node[draw,circle,inner sep=1pt, shade,shading=ball,circle,ball color=black!10!blue] (letter) {TRF};}
\newcommand{\asi}{\tikz[baseline=(letter.base)]\node[draw,circle,inner sep=1pt, shade,shading=ball,circle,ball color=black!10!orange] (letter) {ASI};}
\begin{document}
\section{Chapitre 1} \asi \trf
\section{Chapitre 2}
\subsection{Sous section 2.1}
\subsection{Sous section 2.2}
\end{document}
レベルをタイトル行に表示する方法(そして目次にも表示する方法)
答え1
セクション タイトル内でマクロを使用する場合は注意が必要です。これらのタイトルは、PDF ブックマークやページ ヘッダーやフッターなど、ドキュメント内の他のいくつかの場所に表示されるからです。
それでも、マクロを使用することは可能ですが、マクロのオプション引数でタイトルのマクロなしの代替バージョンを提供する必要があります( 、など\section
の同様のマクロについても同様です)。\chapter
\subsection
\documentclass{article}
\usepackage{tikz}
\newcommand{\atrf}{\tikz[baseline=(letter.base)]\node[draw,circle,inner sep=1pt, shade,shading=ball,circle,ball color=black!10!red] (letter) {ATRF};}
\newcommand{\trf}{\tikz[baseline=(letter.base)]\node[draw,circle,inner sep=1pt, shade,shading=ball,circle,ball color=black!10!blue] (letter) {TRF};}
\newcommand{\asi}{\tikz[baseline=(letter.base)]\node[draw,circle,inner sep=1pt, shade,shading=ball,circle,ball color=black!10!orange] (letter) {ASI};}
\begin{document}
\section[Chapitre 1 (ASI) (TRF)]{Chapitre 1 \asi \trf}
\section{Chapitre 2}
\subsection{Sous section 2.1}
\subsection{Sous section 2.2}
\end{document}
答え2
コードの重複を避けるには、コマンドを2つの引数を持つコマンドで定義し、必要なTiを供給します。けZ 命令は、目次をタイプセットするときに別のものにすることができます (ボールもそこに置きたい場合を除く)。
次に、そのようなコマンドを堅牢なコマンドとして定義し、動的な議論でも生き残るようにします。
\documentclass{article}
\usepackage{tikz}
\newcommand{\shadedball}[2]{% #1 = color, #2 = acronym
\ifintoc
(\textcolor{black!10!#1}{#2})%
\else
\begin{tikzpicture}[baseline=(letter.base)]
\node[
draw,
circle,
inner sep=1pt,
shade,
shading=ball,
circle,
ball color=black!10!#1,
minimum width=3em,% <--- to get balls of the same width
] (letter) {#2};
\end{tikzpicture}%
\fi
}
\newif\ifintoc
\DeclareRobustCommand{\atrf}{\shadedball{red}{ARTF}}
\DeclareRobustCommand{\trf}{\shadedball{blue}{TRF}}
\DeclareRobustCommand{\asi}{\shadedball{orange}{ASI}}
\begin{document}
\intoctrue
\tableofcontents
\intocfalse
\section{Chapitre 1 \asi\ \trf\ \atrf}
\end{document}
条件付きビジネスがなければ
\documentclass{article}
\usepackage{tikz}
\newcommand{\shadedball}[2]{% #1 = color, #2 = acronym
\begin{tikzpicture}[baseline=(letter.base)]
\node[
draw,
circle,
inner sep=1pt,
shade,
shading=ball,
circle,
ball color=black!10!#1,
minimum width=3em,% <--- to get balls of the same width
] (letter) {#2};
\end{tikzpicture}%
}
\DeclareRobustCommand{\atrf}{\shadedball{red}{ARTF}}
\DeclareRobustCommand{\trf}{\shadedball{blue}{TRF}}
\DeclareRobustCommand{\asi}{\shadedball{orange}{ASI}}
\begin{document}
\tableofcontents
\section{Chapitre 1 \asi\ \trf\ \atrf}
\end{document}