![추악한 해결 방법에 대한 더 깔끔한 대안](https://rvso.com/image/400358/%EC%B6%94%EC%95%85%ED%95%9C%20%ED%95%B4%EA%B2%B0%20%EB%B0%A9%EB%B2%95%EC%97%90%20%EB%8C%80%ED%95%9C%20%EB%8D%94%20%EA%B9%94%EB%81%94%ED%95%9C%20%EB%8C%80%EC%95%88.png)
저는 회고록 수업으로 문제지 풀이를 쓰고 있어요. 원본 시트의 문제 라벨을 유지하고 싶습니다.
문제 시트 1
문제 1.13.1로렘 입숨 ...
문제 1.13.2로렘 입숨 ...
그렇게 하는 방법은 다음과 같습니다(정돈되지 않은 MWE).
\documentclass[extrafontsizes,oneside,20pt]{memoir}
\usepackage{enumitem}
\usepackage{hyperref}
\usepackage{memhfixc}
% ugly workaround (1)
\newcommand{\sectionitem}{%
\item\phantomsection\addcontentsline{toc}{section}{%
\let\sectionitemfont\relax%
\labelenumi%
\let\sectionitemfont\bfseries%
}%
}
\def\mychapter{Problem sheet}
\makechapterstyle{mine}{%
\renewcommand{\printchaptername}{\chapnumfont \mychapter}
\renewcommand{\printchaptertitle}[1]{}
}
\renewcommand*{\cftchaptername}{\mychapter\space}
\begin{document}
\clearpage
\chapterstyle{default} % (2)
\tableofcontents
\clearpage
\chapterstyle{mine} % (2)
\let\sectionitemfont\bfseries
\chapter{A}
\begin{enumerate}[
leftmargin=*,
label=\sectionitemfont problem 1.13.\arabic*
]
\sectionitem Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\\
\textbf{solution}
\sectionitem Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\\
\textbf{solution}
\sectionitem Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\\
\textbf{solution}
\end{enumerate}
\end{document}
추악한 해결 방법은 열거 항목을 ToC에 강제로 표시하는 데 (1)
사용됩니다 . \labelenumi
결과는 내가 원하는 것이지만 하이퍼참조 경고가 있습니다.
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing `\<let>-command' on input line 39.
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing `\sectionitemfont' on input line 39.
내가 또한 싫어하는 점은 챕터 스타일 전환입니다 (2)
. 장(문제 시트) 이름이 ToC에만 표시되기를 원하지만 크게 유지하고 싶습니다.내용물제목. Memoir에는 \renewcommand{\printchaptertitle}[1]
장 제목을 끌 수 있는 명령이 있습니다 (그러나내용물장 제목이기도 함).
동일한 결과를 얻는 더 깔끔한 방법이 있습니까?
PS 회고록 매뉴얼 \newcommand{\printchaptertitle}[1]{\chaptitlefont #1}
88페이지의 기본값은 위의 MWE( renewcommand
)에서 오류를 제공하지만 ##1
그렇지 않고 작동합니다.
답변1
이것이 해결책이 될 수 있습니다:
\documentclass[extrafontsizes,oneside,20pt]{memoir}
\usepackage{enumitem}
\usepackage{hyperref}
\usepackage{memhfixc}
\newenvironment{probsol}[1][\thesection]{\begin{enumerate}[leftmargin=*,
label=\sectionitemfont#1.\arabic{enumi}]\let\olditem\item\def\item{\olditem\addcontentsline{toc}{section}{#1.\arabic{enumi}}}}
{\end{enumerate}}
\def\mychapter{Problem sheet}
\makechapterstyle{mine}{%
\renewcommand{\printchaptername}{\chapnumfont \mychapter}
\renewcommand{\printchaptertitle}[1]{}
}
\begin{document}
\clearpage
\chapterstyle{default} % (2)
\tableofcontents
\clearpage
\chapterstyle{mine} % (2)
\let\sectionitemfont\bfseries
\chapter{A}
\begin{probsol}[problem 1.13]
\item Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\\
\textbf{solution}
\item Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\\
\textbf{solution}
\item Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\\
\textbf{solution}
\end{probsol}
\end{document}