
\nameref
가 로드 되면 star
버전이 section
중단 됩니다 . 기본적으로 단락에 번호를 매기는 문서가 있는데, 번호를 매기고 싶지는 않지만 참고하고 싶은 몇 가지가 있습니다. 로 표시되어 있지만 패키지가 동시에 로드 되면 빈 문자열이 표시됩니다(하이퍼참조의 링크 상자는 계속 표시됩니다).paragraph
titlesec
\paragraph*
titlesec
nameref
MWE:
\documentclass[12pt]{article}
\usepackage[sf]{titlesec} %comment this out and it works fine.
\usepackage{hyperref}
\begin{document}
\section{Sections}
\label{sec}
This is \nameref{sec}
\paragraph{A named Paragraph}
\label{par}
This is \nameref{par}
\paragraph*{A starred named Paragraph}
\label{par:star}
This is \nameref{par:star}
\end{document}
나는 titlesec이 섹션화 명령의 모든 스타 변형에 대해 이 결함을 일으키는 것으로 의심하지만 이를 테스트하지 않았습니다. 나에게만 paragraph*
관련이 있지만 모든 변형에 대한 수정이 가장 좋습니다.
나는 이것이 이것과 관련이 있을 수 있다는 직감을 가지고 있습니다:https://tex.stackexchange.com/a/6658/19326그러나 이것은 내 라텍스 지식을 뛰어넘는 일이며 나에게는 단지 "마법"일 뿐입니다.
답변1
프리앰블에 다음을 추가하세요.
\makeatletter
\def\ttl@useclass#1#2{%
\@ifstar
{\ttl@labeltrue\@dblarg{#1{#2}}}% {\ttl@labelfalse#1{#2}[]}%
{\ttl@labeltrue\@dblarg{#1{#2}}}}
\makeatother
\<section>[<ToC>]{<regular>}
이를 통해 섹션 단위로 일반 인수를 처리할 수 있습니다 \<section>
. 또한 설정에 따라 \ttl@labeltrue
적절한 항목이 삽입됩니다.hyperref
닻.
\documentclass[12pt]{article}
\usepackage[sf]{titlesec} %comment this out and it works fine.
\usepackage{hyperref}
\makeatletter
\def\ttl@useclass#1#2{%
\@ifstar
{\ttl@labelfalse\@dblarg{#1{#2}}}% {\ttl@labelfalse#1{#2}[]}%
{\ttl@labeltrue\@dblarg{#1{#2}}}}
\makeatother
\begin{document}
\section{Sections}
\label{sec}
This is \nameref{sec}
\paragraph{A named Paragraph}
\label{par}
This is \nameref{par}
\paragraph*{A starred named Paragraph}
\label{par:star}
This is \nameref{par:star}
\end{document}
광범위하게 테스트되지 않았습니다.