
내 강좌에서는 원으로 표시된 수준을 사용하여 각 하위 파트의 수준을 지정하고 싶습니다.
명령을 사용하면 \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
코드 중복을 피하고 싶습니다. 필요한 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}