
매우 긴 섹션 제목이 있는데 목차 항목에 하이픈을 넣기를 원하지 않습니다.
\documentclass{scrreprt}
%\usepackage[ngerman]{babel}
\usepackage{tocloft}
\cftsetindents{section}{0mm}{12mm}
\cftsetindents{chapter}{0mm}{12mm}
\begin{document}
\tableofcontents
\chapter{Introduction}
\section{This kind of problem, that kind of problem, other ones and further considerations}
\section{More problems, even more problems, much worse than these, headline hyphenation, and blablablablablablablablabla and XYZ-blablablablablablablablabla}
\end{document}
인터넷 검색을 통해 도움이 될 것이라는 인상을 받았지만 \renewcommand{\cftsecfont}{\raggedright}
그렇지 않습니다. \begingroup \raggedright \tableofcontents \endgroup
둘 다 그렇지 않습니다 .관련 질문에 대한 유일한 (허용되지 않는) 답변. ( 주석을 제거하면 \usepackage{ngerman]{babel}
흥미롭게도 "considerations"의 하이픈 연결이 "considerations"로 변경됩니다.)
를 사용하지 않거나 tocloft
문서 클래스를 로 변경하는 경우 book
(예: 다른 음절에 하이픈 사용)에도 문제가 발생합니다.
문제가 되는 모든 단어에 대해 하이픈을 다시 정의하지 않고도 TOC에서 하이픈을 완전히 없앨 수 있나요? 솔루션에서 긴 단어가 최종 "blabla..."와 같이 줄을 넘어가지 않는 경우 보너스 포인트가 제공되며, 하이픈("XYZ-blabla")으로 시작하는 단어 조합을 가져올 수 있는 경우 더 많은 보너스 포인트가 제공됩니다. 같은 줄.
답변1
KOMA 클래스를 사용하고 있으므로 갈 방법은 다음을 사용하는 것입니다.tocstyle
패키지:
코드:
\documentclass{scrreprt}
\usepackage[ngerman]{babel}
\usepackage[tocflat]{tocstyle}
\newtocstyle{raggedstyle}{%
\settocstylefeature[0]{entryhook}{\bfseries}
\settocstylefeature[0]{leaders}{\hfill}
\settocfeature{raggedhook}{\raggedright}
\settocfeature{spaceafternumber}{17pt}
}
\usetocstyle{raggedstyle}
\begin{document}
\tableofcontents
\chapter{Introduction}
\section{This kind of problem, that kind of problem, other ones and further considerations}
\section{More problems, even more problems, much worse than these, headline with no hyphenation and somo more text goes here for the example}
\end{document}
추가 조정은 패키지 설명서를 참조하세요.
답변2
scrreprt
나는 당신이 사용하고 있고 로딩을 건너 뛰는 것을 고려하여 Gonzalo Medina의 답변을 사용하고 싶지만 tocloft
솔루션 tocloft
은 너무 까다롭지 않으며 memoir
사용자에게도 유용합니다.
\documentclass{scrreprt}
\usepackage[ngerman]{babel}
\usepackage{tocloft}
\cftsetindents{section}{0mm}{12mm}
\cftsetindents{chapter}{0mm}{12mm}
\makeatletter
% \renewcommand{\@tocrmarg}{2.55em plus1fil}
\renewcommand{\@tocrmarg}{\@pnumwidth plus1fil} % <-- Revised
\makeatother
\begin{document}
\tableofcontents
\chapter{Introduction}
\section{This kind of problem, that kind of problem, other ones and further considerations}
\section{More problems, even more problems, much worse than these, headline hyphenation, and blablablablablablablablabla and XYZ-blablablablablablablablabla}
\end{document}
일반적으로 (TOC Right MARGin)의 수정된 값이 (Page NUMber WIDTH) \@tocrmarg
의 수정된 값보다 큰지 확인해야 합니다 .\@pnumwidth
답변3
tocloft
KOMA-Script 클래스와 함께 패키지를 사용하는 것은 권장되지 않습니다. 다음은 이 패키지가 없고 내부 명령을 재정의하지 않은 제안입니다.
\documentclass{scrreprt}
\RedeclareSectionCommands[
tocindent=0mm,
tocnumwidth=12mm,
tocraggedentrytext
]{chapter,section}
\begin{document}
\tableofcontents
\chapter{Introduction}
\section{This kind of problem, that kind of problem, other ones and further considerations}
\section{More problems, even more problems, much worse than these, headline hyphenation, and blablablablablablablablabla and XYZ-blablablablablablablablabla}
\end{document}
결과:
toc=flat
다음을 설정하는 대신 tocindent=0mm
클래스 옵션을 사용할 수도 있습니다 tocnumwidth=12mm
.
\documentclass[toc=flat]{scrreprt}
\RedeclareSectionCommands[
tocraggedentrytext
]{chapter,section}
\begin{document}
\tableofcontents
\chapter{Introduction}
\section{This kind of problem, that kind of problem, other ones and further considerations}
\section{More problems, even more problems, much worse than these, headline hyphenation, and blablablablablablablablabla and XYZ-blablablablablablablablabla}
\end{document}
정렬을 위해서는 추가 실행이 필요합니다.
결과:
답변4
패키지 를 사용한 솔루션 titletoc
:
\documentclass{scrreprt}
\usepackage[showframe]{geometry}
%\usepackage[ngerman]{babel}
\usepackage{ragged2e}
\usepackage{fmtcount}
\usepackage{titletoc}
\titlecontents{chapter}[12mm]
{\contentsmargin{10mm}\bigskip\sffamily\bfseries\Large}
{\contentslabel[\MakeUppercase{\romannumeral\thecontentslabel}]{12mm}}
{}
{\hfill\contentspage}[\medskip]
\titlecontents{section}[12mm]
{ \rightskip=10mm plus 1fil\hyphenpenalty=10000\contentsmargin{2mm}}%
{\contentslabel[\thecontentslabel.]{12mm}}
{}
{\hskip2pt\titlerule*[6pt]{.}\contentspage}
\begin{document}
\tableofcontents
\setcounter{page}{100}
\chapter{Introduction}
\section{This kind of problem, that kind of problem, other ones and further considerations}
\section{More problems, even more problems, much worse than these, headline hyphenation, and blablablablablablablablabla and XYZblablablablablablablablabla}
\end{document}