장 헤더에 기호 추가

장 헤더에 기호 추가

"|"를 추가하고 싶습니다. 기호 또는 수직선을 장 헤더에 추가하여 다음과 같이 만듭니다.

원본 코드는 다음과 같습니다.

\documentclass[svgnames]{book}

\usepackage{tikz}
\usepackage{kpfonts}
\usepackage[explicit]{titlesec}
\newcommand*\chapterlabel{}

\titleformat{\chapter}
  {\gdef\chapterlabel{}
   \normalfont\sffamily\Huge\bfseries\scshape}
  {\gdef\chapterlabel{\thechapter\ }}{0pt}
  {\begin{tikzpicture}[remember picture,overlay]
    \node[yshift=-3cm] at (current page.north west)
      {\begin{tikzpicture}[remember picture, overlay]
        \draw[fill=LightSkyBlue] (0,0) rectangle
          (\paperwidth,3cm);
        \node[anchor=east,xshift=.9\paperwidth,rectangle,
              rounded corners=20pt,inner sep=11pt,
              fill=MidnightBlue]
              {\color{white}\chapterlabel#1};
       \end{tikzpicture}
      };
   \end{tikzpicture}
  }
\titlespacing*{\chapter}{0pt}{50pt}{-60pt}

\begin{document}
\tableofcontents
\chapter{Decision Trees}
Text
\chapter{Main}

\section{Section}
Text
\begin{thebibliography}{99}
\bibitem{Test} test reference

\end{thebibliography}
\end{document} 

답변1

\chapterlabel #1수직선을 삽입하는 곳입니다. \chapterlabel번호가 없는 장의 경우 비어 있거나 후행 공백을 포함한 장 번호가 포함되어 있습니다.

수직선은 으로 추가할 수 있습니다 \vrule. 너비는 키워드로 구성할 수 있습니다 width. \vrule width 1pt높이와 깊이는 선의 높이와 깊이에 따라 다르며 장마다 다를 수 있습니다. 상수 규칙은 다음과 같이 사용할 수 있습니다 $|$. 다음 예에서는 굵게 표시된 버전이 사용되었습니다.

\documentclass[svgnames]{book}

\usepackage{tikz}
\usepackage{kpfonts}
\usepackage[explicit]{titlesec}
\newcommand*\chapterlabel{}

\titleformat{\chapter}
  {\gdef\chapterlabel{}
   \normalfont\sffamily\Huge\bfseries\scshape}
  {\gdef\chapterlabel{\thechapter\ }}{0pt}
  {\begin{tikzpicture}[remember picture,overlay]
    \node[yshift=-3cm] at (current page.north west)
      {\begin{tikzpicture}[remember picture, overlay]
        \draw[fill=LightSkyBlue] (0,0) rectangle
          (\paperwidth,3cm);
        \node[anchor=east,xshift=.9\paperwidth,rectangle,
              rounded corners=20pt,inner sep=11pt,
              fill=MidnightBlue]
              {\color{white}%
                  \ifx\chapterlabel\empty
                  \else
                    \chapterlabel $\boldsymbol{|}$ %
                  \fi
                  #1};
       \end{tikzpicture}
      };
   \end{tikzpicture}
  }
\titlespacing*{\chapter}{0pt}{50pt}{-60pt}

\begin{document}
\tableofcontents
\chapter{Decision Trees}
Text
\chapter{Main}

\section{Section}
Text
\begin{thebibliography}{99}
\bibitem{Test} test reference

\end{thebibliography}
\end{document}

페이지 3:

페이지 3

페이지 7:

7페이지

관련 정보