
Estoy tratando de combinarMayúsculas, cursiva e hipervínculos en toque de scrartcl sin usar tocstyleyCapítulo en mayúsculas con escritura 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
Sin embargo, los enlaces TOC no llevan a ninguna parte. Alguna idea de cómo solucionar este problema?
Intenté reemplazar
\addtocentrydefault{section}{#1}{\texorpdfstring{\MakeUppercase{#2}}{#2}}%
con
\addtocentrydefault{section}{#1}{\texorpdfstring{\MakeUppercase{#2}}{\MakeUppercase{#2}}}%
pero me sale el \MakeUppercase ...ppercaseUnsupportedInPdfStrings
error. El documento está elaborado con pandoc, por lo que solo puedo agregar algunos fragmentos de látex.
Soy completamente nuevo en LaTeX, por lo que realmente agradecería no solo una solución, sino también cualquier sugerencia sobre cómo depurar estos problemas yo mismo.
UPD: a continuación se muestra un ejemplo mínimo reproducible:
% 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}
Respuesta1
Actualizar:
Incluso si agrego \setcounter{secnumdepth}{-\maxdimen}
el código todavía funciona para mí, pero uso la versión actualizada de KOMA-Script 3.31 (22/07/2020). En versiones anteriores había un problema con hyperref
las secciones sin numerar, verBekannte Probleme und Änderungen en KOMA-Script 3.30(Alemán). Entonces tal vez tengas que actualizar.
% 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}
Respuesta original:
Anhelar un comentario:
El siguiente ejemplo funciona para mí.
\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}
Resultado: