
나는 여기의 상자 장 스타일을 좋아합니다.http://hstuart.dk/2007/05/21/styling-the-chapter/
다음은 이 스타일을 기반으로 한 MWE입니다.
\documentclass{memoir}
\usepackage{tikz, blindtext}
\makechapterstyle{box}{
\renewcommand*{\printchaptername}{}
\renewcommand*{\chapnumfont}{\normalfont\sffamily\huge\bfseries}
\renewcommand*{\printchapternum}{
\flushright
\begin{tikzpicture}
\draw[fill,color=black] (0,0) rectangle (2cm,2cm);
\draw[color=white] (1cm,1cm) node { \chapnumfont\thechapter };
\end{tikzpicture}
}
\renewcommand*{\chaptitlefont}{\normalfont\sffamily\Huge\bfseries}
\renewcommand*{\printchaptertitle}[1]{\flushright\chaptitlefont##1}
}
\chapterstyle{box}
\begin{document}
\chapter{Fancy chapter with TikZ}
\blindtext
\end{document}
이제 1과 2로 표시된 공백 중 일부를 제거하고 싶습니다(따라서 상자 위와 아래, 대부분 상자 위). 물론 약간의 공백이 있어야 하지만 장 제목이 많은 공간을 차지하지 않기 때문에 다소 작아야 합니다. 이것을 달성하는 방법에 대한 아이디어가 있습니까?
보너스 질문: 수업을 이용하면서 모든 것을 할 수 있나요? ( 나중에 수업이 나에게 report
어떤 불이익을 가져올 수 있는지 모르겠습니다 )?memoir
미리 감사드립니다.
답변1
여기 있습니다.
\documentclass{report}
\usepackage{tikz, blindtext,showframe} %% blindtext,showframe just for demo
\usepackage{titlesec}
\newcommand*{\chapnumfont}{\normalfont\sffamily\huge\bfseries}
\newcommand*{\chaptitlefont}{\normalfont\sffamily\Huge\bfseries}
\newcommand{\mybox}{%
\begin{tikzpicture}
\draw[fill,color=black] (0,0) rectangle (2cm,2cm);
\draw[color=white,font=\chapnumfont] (1cm,1cm) node {\thechapter};
\end{tikzpicture}%
}
\titleformat{\chapter}[display]
{}{\filleft\mybox}{20pt}{\filleft\chaptitlefont}
\titlespacing*{\chapter} {0pt}{0pt}{0pt}
\begin{document}
\chapter{Fancy chapter with TikZ}
\blindtext
\end{document}
\titlespacing*{\chapter} {0pt}{0pt}{0pt}
기본적 으로 값을 조정하면 \titlespacing*{\chapter} {0pt}{50pt}{40pt}
모두 0으로 설정됩니다.
20pt
in 은 장 번호와 제목 사이의 수직 공간입니다 ...\mybox}{20pt}...
. \titleformat
원하는 경우 조정하십시오.
답변2
다음의 특정 매개변수를 설정하려고 합니다 memoir
.
\documentclass{memoir}
\usepackage{tikz, blindtext,showframe}
\makechapterstyle{box}{%
\setlength{\beforechapskip}{0pt}% was 50pt
\setlength{\midchapskip}{20pt}%
\setlength{\afterchapskip}{20pt}% was 40pt
\renewcommand*{\printchaptername}{}%
\renewcommand*{\chapnumfont}{\normalfont\sffamily\huge\bfseries}%
\renewcommand*{\printchapternum}{%
\flushright
\begin{tikzpicture}
\draw[fill,color=black] (0,0) rectangle (2cm,2cm);
\draw[color=white] (1cm,1cm) node { \chapnumfont\thechapter };
\end{tikzpicture}%
}%
\renewcommand*{\chaptitlefont}{\normalfont\sffamily\Huge\bfseries}%
\renewcommand*{\printchaptertitle}[1]{\flushright\chaptitlefont##1}%
}
\chapterstyle{box}
\begin{document}
\chapter{Fancy chapter with TikZ}
\blindtext
\end{document}
나는 showframe
다양한 페이지 부분의 경계 상자를 분명하게 만들곤 했습니다.