
一開始我使用 parnotes 和 endnotes 來區分兩種不同類型的結束註腳:
- 注意:為了能夠編譯第一個「灰盒」的試用程式碼,必須下載
hyperendnotes
-“套件”-(.sty 檔案)。 - 備註:如果您想了解更多有關什麼
\patchcmd{..}{..}{..}{..}
和\usepackage{etoolbox}
正在做什麼的信息,請參閱這個問題的另一個“子”帖子。
\documentclass{article}
\usepackage{changepage} % \begin{adjustwidth}{...cm}{...cm}
\usepackage[colorlinks=true,linkcolor=red]{hyperref} % colors endnotes red --- for hyperlinks --- hyperref permits use of color{blue}{...}
\usepackage{endnotes} % \endnote{...}
\input{hyperendnotes.sty} % LOADS (needs \usepackage{hyperref}) hyperendnotes.sty; which can be downloaded at
% https://github.com/bibliogum/latexamu/blob/master/hyperendnotes.sty
\def\enoteheading{} % endnotes without standard heading
\usepackage[breakwithin, roman]{parnotes} % parnotes
\makeatletter % needed for \renewcommand{...} and \patchcmd{...}
\renewcommand{\parnotemarkfmt}[1]{{{\color{blue}\PN@mark@set{#1}\hspace{0.5mm}}}} % color parnotes blue --- tweaks spacing --- adjusts size of parnotes to look like hyperendnotes (part 1)
\usepackage{etoolbox} % \patchcmd{...}
\patchcmd{\PN@parnote@real}
{\parnotemarkfmt{PN@t}}
{\textsuperscript{\hspace{1.23mm}\parnotemarkfmt{PN@t}\hspace{-0.67mm}}}
{}{} % <<< adjusts size of parnotes to look like hyperendnotes (part 2) --- thanks a lot for this part @egreg; at
% https://tex.stackexchange.com/questions/219000/a-question-about-using-a-renewcommand-to-adapt-a-package/219007#219007
\makeatother % needed for \renewcommand{...} and \patchcmd{...}
\begin{document}
\noindent Some text \parnote{A parnote} \parnote{Another parnote} \endnote{An endnote} \parnote{Another parnote} \endnote{Another endnote} \endnote{Another endnote} \endnote{Another endnote} \parnote{Another parnote} \parnote{Another parnote} \parnote{Another parnote} \parnote{Another parnote} \endnote{Another endnote} \parnote{Another parnote} \endnote{Another endnote} \endnote{Another endnote} \endnote{Another endnote} \endnote{Another endnote} \endnote{Another endnote} \parnote{Another parnote} \endnote{Another endnote} \parnote{Another parnote} \parnote{Another parnote} \par
\noindent \textbf{Parnotes}
\parnotes
\textbf{Endnotes} \par
\begin{adjustwidth}{2.49mm}{0cm}
\theendnotes
\end{adjustwidth}
\end{document}
所以他們是分開並“標記”就很好(即使兩種“類型”的尾註交織在一起)。
但那個沒有在 parnotes 上取得交叉引用(可點擊連結)...
載入hyperendnotes.sty
僅將可點擊的交叉引用「連結」放在 上\endnote{...}
,而不是放在 上\parnote{...}
。
所以用戶@cfr暗示了enotez
-package。我發現\usepackage{enotez}
至少更容易,因為它不需要hyperendnotes.sty
再加載額外的內容。
在第二次試驗中,我只使用了尾註(我放棄了尾註,因為我無法在它們上獲得可點擊的超連結。
在第二次試驗中,我只使用了尾註(我放棄了尾註,因為我無法在它們上獲得可點擊的超連結。
- 注意:第二個「灰盒」的試用程式碼需要編譯兩次。 (由於
enotez
- 包)。
\documentclass{article}
\usepackage{enotez}
\DeclareInstance{enotez-list}{section}{paragraph}{heading={}}
\setenotez{backref=true, list-style=section, reset, split-title=\noindent}
\usepackage{hyperref}
\hypersetup{colorlinks=true}
\usepackage{biblatex}
\begin{document}
\hypersetup{linkcolor=red}
Som text here \endnote{Endnote}. \par
Some more text \endnote{Endnote} before the first call of \colorbox{gray!20}{\textbackslash printendnotes}.
\vspace{1em} \textbf{A first person's endnotes} \printendnotes \vspace{1em}
\setenotez{counter-format={roman}} \hypersetup{linkcolor=blue}
See? I can get clickable endnotes in two different colours, which is what I wanted. \endnote{Endnote}. \par {\large{But the problem is that ALL of the endnotes (of a certain colour) have to be grouped together and originate before the first \colorbox{gray!20}{\textbackslash printendnotes} and before ALL of the other endnotes (of another colour): there is no freedom to use the endnotes "interwoven", unfortunately.}} \endnote{Endnote}.
\vspace{1em} \textbf{A second person's endnotes} \printendnotes \vspace{2em}
\setenotez{counter-format={arabic}} \hypersetup{linkcolor=red}
You can get both footnote sections to truly follow each-other at the end of the document \endnote{Endnote} (which is what i wanted), by using a lot of \colorbox{gray!20}{\textbackslash vspace}'s (see the .tex-code below this line). But having to constantly adjust the \colorbox{gray!20}{\textbackslash vspace}'s doesn't seem very elegant at all. \endnote{Endnote}
\vspace{8.2em}% extra \vspace{...} to group the endnote sections together at the end of the .pdf
\vspace{1em} \textbf{A first person's endnotes} \printendnotes \vspace{1em}
\setenotez{counter-format={roman}} \hypersetup{linkcolor=blue}
\vspace{-15em}% extra \vspace{...} to group the endnote sections together at the end of the .pdf
See?\endnote{Endnote} Now the the sections are really together \endnote{Endnote} at the very end of the document. \par However: the {\large{origins of the two different types of endnotes still have to be grouped together, and cannot get interwoven, unfortunately.}}
\vspace{8em}% extra \vspace{...} to group the endnote sections together at the end of the .pdf
\vspace{1em} \textbf{A second person's endnotes} \printendnotes \vspace{1em}
\end{document}
現在那裡是所有尾註的交叉引用(可點擊連結)!
但不同種類的尾註不能再是交織在一起。
無法以這種方式正確地對尾註的不同「類型」進行代碼標記(沒有 parnotes)。如果“交織”,這兩種“類型”將不會被編號並單獨放置在文件的底部。
簡而言之。以下任一方法都可以解決我的問題。
任何一個:
- 取得 parnotes 上的交叉引用。
或(使用可交叉引用的尾註時):
- 標記「類型(尾註)」(具有單獨的編號、顏色和數字)並單獨列印。
我開始想知道是否可以提供解決方案不是使用標準的註釋、尾註或註腳嗎?但只需使用其他代碼標籤來區分兩種類型的“註釋”,添加一些上標、編號、著色(“假”尾註)。然後單獨列印?也許(作為最後的手段)與biblatex
?
我猜這個「偽造」或「自主定義腳註」是在德國 QA 網站 texwelt 完成的:這裡或者這裡。我將在下面發布英文(稍作修改)版本:
\documentclass{article}
\usepackage{xcolor}
%%%%%%%%%%%
\newcommand\newnotestype[2]{%
\newcounter{#1note}%
\expandafter\newwrite\csname the#1notes\endcsname
\expandafter\immediate\expandafter\openout\csname
the#1notes\endcsname=\jobname.#1\relax %
\expandafter\newcommand\csname #1note\endcsname[1]{%
\stepcounter{#1note}%
{%
\tiny\textsuperscript\expandafter\textcolor{#2}{{%
\raisebox{1ex}{\hbox{\kern-0.0em\csname
the#1note\endcsname\kern-0.0em}}}}%
\expandafter\immediate\expandafter\write\csname the#1notes\endcsname%
{\csname the#1note\endcsname\ \unexpanded{##1 \par}}%
}}%
\expandafter\newcommand\csname display#1notes\endcsname[1]{%
\vspace{1\baselineskip}%
\expandafter\immediate\expandafter\closeout%
\csname the#1notes\endcsname%
\par\tiny\expandafter\textcolor{#2}{\textbf{##1}}\par%
\input\jobname.#1%
}}%
%%%%%%%%%%%
\newnotestype{first}{red}
\newnotestype{second}{blue}
%%%%%%%%%%%
\begin{document}
This is the test-text \firstnote{Endnote} \secondnote{Endnote} , some more \firstnote{Endnote} test-text, some more \secondnote{Endnote} test-text \secondnote{Endnote}.
%%%%%%%%%%%
\displayfirstnotes{A first person's endnotes}
\displaysecondnotes{A second person's endnotes}
\end{document}
現在有不同種類的尾註可輕鬆貼標並再次交織。
但又有了不再交叉引用(可點擊連結)任何的尾註。
簡單的方法\usepackage{hyperref}
不再有效,因為腳註不是真正的“腳註”:它們是“偽造的”,看起來像它們。
那麼有人知道一個優雅的解決方案來獲得這些「物件」的交叉引用(可點擊的連結)嗎?
還有一些問題:
- 最後(第三次)試驗也為尾註標題著色,但是不是尾註編號(至少不是印尾註的地方)。如果有人也能在尾註編號上獲得顏色,那將是受歡迎的。
- 還有:這邊,那邊不再似乎是從阿拉伯數字切換到羅馬數字的簡單方法(一般來說,特別是對於一種「類型」的尾註)?
非常感謝。