
현재 프로젝트에는 세 부분으로 구성된 문서가 필요합니다. 첫 번째와 마지막 부분에서는 기본 섹션을 원하지만 중간 부분에서는 아래 섹션 수준에 다른 스타일을 적용해야 합니다 \part
. 이 스타일은 와 유사한 별도의 페이지가 필요하므로 다음 과 같은 을 \part
사용하는 것을 고려했습니다 .titlesec
\titleclass
\titleclass{\mysection}{page}[\part]
\chapter
그러나 이로 인해 문서의 다른 부분에 대해 정상적으로 작업해야 하는 등 의 섹션 수준이 이동됩니다 . 섹션 수준을 이전 값으로 재설정하는 방법이 있습니까? 아니면 목표를 달성하는 다른 방법이 있나요?
를 사용하는 것을 고려했지만 \titleformat{\chapter}...
실행 중인 장 번호(첫 번째 부분부터 계속되어야 함)를 포함하여 마지막에 여러 설정을 재설정하는 문제가 발생했으며 이를 수행하는 방법도 완전히 모르겠습니다.
답변1
제가 질문을 오해하고 있는지는 모르겠지만, 문서 본문 내에서 섹션 제목의 형식을 다시 정의하는 데에는 문제가 없습니다. 여기서는 \section을 사용하지만 장, 부분 등에 대해서도 동일한 작업을 수행할 수 있습니다.
재정의한 후의 제목은 다시 재정의할 때까지 새로운 형식을 사용합니다.
저는 형식 지정을 위한 예로 tcolorbox를 사용하고 있습니다. 원하는 대로 사용할 수 있습니다.
\documentclass[10pt]{article}
\usepackage[explicit]{titlesec}
\usepackage[most]{tcolorbox}
%original definition
\titleformat{\section}
{\normalfont\bfseries\itshape\fontsize{12.8}{14}\selectfont}
{}{0pt}
{\begin{tcolorbox}[]\thesection\hskip0.7em#1\end{tcolorbox}}
%end of original definition
\begin{document}
\section{A section}
Bla bla
\section{Another section}
\subsection{A Subsection}
%another definition
\titleformat{\section}
{\normalfont\bfseries\itshape\fontsize{12.8}{14}\selectfont}
{}{0pt}
{\begin{tcolorbox}[
enhanced,
boxrule=0pt,
arc=0pt,
outer arc=0pt,
interior code={\fill[overlay,cyan!30] (frame.north west) rectangle (frame.south east);},
]\thesection\hskip0.7em#1\end{tcolorbox}}
%end of other definition
\section{Another section with a difference}
\subsection{Another subsection}
\end{document}