
합치려고 하는데tocstyle을 사용하지 않고 scrartcl의 toc에 있는 대문자, 이탤릭체 및 하이퍼링크그리고KOMA 스크립트가 포함된 대문자 장:
\renewcommand\addsectiontocentry[2]{%
\addtocentrydefault{section}{#1}{\texorpdfstring{\MakeUppercase{#2}}{#2}}%
}
\renewcommand\addsubsectiontocentry[2]{%
\addtocentrydefault{subsection}{#1}{\texorpdfstring{\MakeUppercase{#2}}{#2}}%
}
\renewcommand\addsubsubsectiontocentry[2]{%
\addtocentrydefault{subsubsection}{#1}{\texorpdfstring{\MakeUppercase{#2}}{#2}}%
}
\makeatletter
\renewcommand\sectionlinesformat[4]{%
\@hangfrom{\hskip#2#3}{\MakeUppercase{#4}}%
}
\makeatother
그러나 TOC 링크는 어디로도 연결되지 않습니다. 이 문제를 해결하는 방법에 대한 아이디어가 있습니까?
교체하려고 했는데
\addtocentrydefault{section}{#1}{\texorpdfstring{\MakeUppercase{#2}}{#2}}%
~와 함께
\addtocentrydefault{section}{#1}{\texorpdfstring{\MakeUppercase{#2}}{\MakeUppercase{#2}}}%
하지만 \MakeUppercase ...ppercaseUnsupportedInPdfStrings
오류가 발생합니다. 문서는 pandoc으로 제작되었기 때문에 라텍스 조각 몇 개만 추가할 수 있습니다.
저는 LaTeX를 처음 접했기 때문에 솔루션뿐만 아니라 이러한 문제를 직접 디버깅하는 방법에 대한 힌트도 정말 감사하게 생각합니다.
UPD: 아래는 재현 가능한 최소한의 예입니다.
% Run "xelatex example.tex" (twice) to compile to pdf
\documentclass{scrartcl}
\usepackage{blindtext}% only for dummy text
\setcounter{tocdepth}{\subsubsectiontocdepth}
\renewcommand\addsectiontocentry[2]{%
\addtocentrydefault{section}{#1}{\texorpdfstring{\MakeUppercase{#2}}{#2}}%
}
\renewcommand\addsubsectiontocentry[2]{%
\addtocentrydefault{subsection}{#1}{\texorpdfstring{\MakeUppercase{#2}}{#2}}%
}
\renewcommand\addsubsubsectiontocentry[2]{%
\addtocentrydefault{subsubsection}{#1}{\texorpdfstring{\MakeUppercase{#2}}{#2}}%
}
\makeatletter
\renewcommand\sectionlinesformat[4]{%
\@hangfrom{\hskip #2#3}{\MakeUppercase{#4}}%
}
\makeatother
\renewcommand{\sectioncatchphraseformat}[4]{%
\hskip #2#3\MakeUppercase{#4}%
}
\usepackage{hyperref}
% This command breaks TOC hyperlinks
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\begin{document}
\tableofcontents
\blinddocument
\blinddocument
\end{document}
답변1
업데이트:
코드를 추가해도 \setcounter{secnumdepth}{-\maxdimen}
여전히 작동하지만 최신 KOMA-Script 버전 3.31(2020/07/22)을 사용합니다. 이전 버전에서는 hyperref
번호가 없는 섹션 에 문제가 있었습니다 .KOMA-Script 3.30의 문제 및 해결 방법(독일 사람). 그래서 업데이트해야 할 수도 있습니다.
% Run "xelatex example.tex" (twice) to compile to pdf
\documentclass{scrartcl}[2020/07/22]% version 3.31 or newer
\usepackage{blindtext}% only for dummy text
\setcounter{tocdepth}{\subsubsectiontocdepth}
\renewcommand\addsectiontocentry[2]{%
\addtocentrydefault{section}{#1}{\texorpdfstring{\MakeUppercase{#2}}{#2}}%
}
\renewcommand\addsubsectiontocentry[2]{%
\addtocentrydefault{subsection}{#1}{\texorpdfstring{\MakeUppercase{#2}}{#2}}%
}
\renewcommand\addsubsubsectiontocentry[2]{%
\addtocentrydefault{subsubsection}{#1}{\texorpdfstring{\MakeUppercase{#2}}{#2}}%
}
\makeatletter
\renewcommand\sectionlinesformat[4]{%
\@hangfrom{\hskip #2#3}{\MakeUppercase{#4}}%
}
\makeatother
\renewcommand{\sectioncatchphraseformat}[4]{%
\hskip #2#3\MakeUppercase{#4}%
}
\usepackage{hyperref}
% This command breaks TOC hyperlinks
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\begin{document}
\KOMAScriptVersion% added to show the KOMA-Script version in the document
\tableofcontents
\blinddocument
\blinddocument
\end{document}
원래 답변:
댓글을 기다리려면:
다음 예는 나에게 효과적입니다.
\documentclass{scrartcl}
\usepackage{blindtext}% only for dummy text
\setcounter{tocdepth}{\subsectiontocdepth}
\makeatletter
\renewcommand\sectionlinesformat[4]{%
\@hangfrom{\hskip#2#3}{\MakeUppercase{#4}}%
}
\makeatother
\renewcommand{\sectioncatchphraseformat}[4]{%
\hskip#2#3\MakeUppercase{#4}%
}
\renewcommand\addsectiontocentry[2]{%
\addtocentrydefault{section}{#1}{\texorpdfstring{\MakeUppercase{#2}}{#2}}%
}
\renewcommand\addsubsectiontocentry[2]{%
\addtocentrydefault{subsection}{#1}{\texorpdfstring{\MakeUppercase{#2}}{#2}}%
}
\usepackage{hyperref}
\begin{document}
\tableofcontents
\blinddocument
\blinddocument
\end{document}
결과: