
我正在使用mdframed
來顯示大型項目清單。在這個清單中,有一有些項目有例外,我試著透過腳註來記錄這一點。註腳的文字與以下內容相同全部例外情況。所以我想要的是:
- 使用相同符號的多個腳註(在每個 mdframed 中)
- 每個腳註都連結到一末尾的一段文字每個多幀
我嘗試過駭客下面基於使用 hyperref 支援在小型頁面內製作全域腳註,這為我提供了相同的腳註符號,但只有最後一個腳註被正確連結。
筆記:
- 如果可能的話我比較願意不是必須進行多次運行。由於腳註的一個瞬間不需要多次運行,我認為沒有它應該是可行的。
參考:
代碼:
\documentclass{article}
\usepackage{mdframed}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage[colorlinks=true]{hyperref}
\makeatletter
%% Adapted from https://tex.stackexchange.com/questions/119092/making-global-footnotes-inside-a-minipage-with-hyperref-support
\newcommand*{\MyFootnoteMark}{%
\footnotemark%
% \global\let\saved@Href@A\Hy@footnote@currentHref%
\addtocounter{footnote}{-1}%
}%
\newcommand*{\MyFootnoteText}[1]{%
%% \addtocounter{footnote}{-1}%
% \let\Hy@footnote@currentHref\saved@Href@A%
\footnotetext{#1}%
\stepcounter{footnote}%
}%
\makeatother
%https://tex.stackexchange.com/questions/175951/changing-footnote-symbol-within-mdframed
\makeatletter
\def\@fnsymbol#1{\ensuremath{\ifcase#1\or \dagger\or \ddagger\or
\mathsection\or \mathparagraph\or \|\or **\or \dagger\dagger
\or \ddagger\ddagger \else\@ctrerr\fi}}%
\renewcommand\thefootnote{\fnsymbol{footnote}}
\renewcommand\thempfootnote{\fnsymbol{mpfootnote}}
\makeatother
\newcommand*{\MyContent}[1][yellow!20]{%
\begin{mdframed}[backgroundcolor=#1]
\lipsum[1-2]
\begin{minipage}{\linewidth}\color{blue}
Hey, look at me.\MyFootnoteMark
\end{minipage}%
\par\lipsum[2]
\begin{minipage}{\linewidth}\color{blue}
Hey, look at me\MyFootnoteMark again.\par
\end{minipage}%
\par\lipsum[3-6]
\MyFootnoteText{This is the text that all the footnotes refers to.}
\end{mdframed}%
}%
\begin{document}
\MyContent[yellow!20]
\MyContent[green!20]
\end{document}
答案1
我真的不知道我在做什麼!我該睡覺了!
補充\addtocounter{Hfootnote}{-1}%
一下。
\documentclass{article}
\usepackage{mdframed}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage[colorlinks=true]{hyperref}
\makeatletter
%% Adapted from http://tex.stackexchange.com/questions/119092/making-global-footnotes-inside-a-minipage-with-hyperref-support
\newcommand*{\MyFootnoteMark}{%
\footnotemark%
% \global\let\saved@Href@A\Hy@footnote@currentHref%
\addtocounter{footnote}{-1}%
\addtocounter{Hfootnote}{-1}% Added
}%
\newcommand*{\MyFootnoteText}[1]{%
%% \addtocounter{footnote}{-1}%
% \let\Hy@footnote@currentHref\saved@Href@A%
\footnotetext{#1}%
\stepcounter{footnote}%
\stepcounter{Hfootnote}% %% Added
}%
\makeatother
%http://tex.stackexchange.com/questions/175951/changing-footnote-symbol-within-mdframed
\makeatletter
\def\@fnsymbol#1{\ensuremath{\ifcase#1\or \dagger\or \ddagger\or
\mathsection\or \mathparagraph\or \|\or **\or \dagger\dagger
\or \ddagger\ddagger \else\@ctrerr\fi}}%
\renewcommand\thefootnote{\fnsymbol{footnote}}
\renewcommand\thempfootnote{\fnsymbol{mpfootnote}}
\makeatother
\newcommand*{\MyContent}[1][yellow!20]{%
\begin{mdframed}[backgroundcolor=#1]
\lipsum[1-2]
\begin{minipage}{\linewidth}\color{blue}
Hey, look at me.\MyFootnoteMark
\end{minipage}%
\par\lipsum[2]
\begin{minipage}{\linewidth}\color{blue}
Hey, look at me\MyFootnoteMark again.\par
\end{minipage}%
\par\lipsum[3-6]
\MyFootnoteText{This is the text that all the footnotes refers to.}
\end{mdframed}%
}%
\begin{document}
\MyContent[yellow!20]
\MyContent[green!20]
\end{document}
另一個醜陋的黑客將腳註中的符號帶回來
\documentclass{article}
\usepackage{mdframed,footnote}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{xparse}
\usepackage[colorlinks=true]{hyperref}
\makeatletter
%% Adapted from http://tex.stackexchange.com/questions/119092/making-global-footnotes-inside-a-minipage-with-hyperref-support
\newcommand*{\MyFootnoteMark}{%
\footnotemark%
\addtocounter{footnote}{-1}%
\addtocounter{Hfootnote}{-1}% Added
}%
\newcommand{\MyFootnoteText}[1]{%
\footnotetext[\numexpr\value{footnote}+1\relax]{#1}%
\refstepcounter{footnote}%
\refstepcounter{Hfootnote}% %% Added
}%
\makeatother
%http://tex.stackexchange.com/questions/175951/changing-footnote-symbol-within-mdframed
\makeatletter
\def\@fnsymbol#1{\ensuremath{\ifcase#1\or \dagger\or \ddagger\or
\mathsection\or \mathparagraph\or \|\or **\or \dagger\dagger
\or \ddagger\ddagger \else\@ctrerr\fi}}%
\renewcommand\thefootnote{\fnsymbol{footnote}}
\renewcommand\thempfootnote{\fnsymbol{mpfootnote}}
\makeatother
\NewDocumentCommand{\MyContent}{O{yellow!20}O{}}{%
\begin{mdframed}[backgroundcolor=#1]
\lipsum[1-2]
\begin{minipage}{\linewidth}\color{blue}
Hey, look at me.\MyFootnoteMark
\end{minipage}%
\par\lipsum[2]
\begin{minipage}{\linewidth}\color{blue}
Hey, look at me\MyFootnoteMark again.\par
\end{minipage}%
\par\lipsum[3-6]
\MyFootnoteText{This is the text that all the footnotes refers to.}
\end{mdframed}%
}%
\begin{document}
\MyContent[yellow!20]
\MyContent[green!20]
\end{document}