
Ich verwende eine mdframed
zur Anzeige einer großen Liste von Elementen. In dieser Liste gibt eseinsAusnahme, die einige der Punkte haben, und ich versuche, dies durch eine Fußnote zu vermerken. Der Text der Fußnote ist derselbe füralledie Ausnahmen. Was ich also möchte, ist:
- Mehrere Fußnoten mit demselben Symbol (in jedem MDFramed)
- Jede der Fußnoten mit Links zu deneinsTextstück am Ende vonjedeAbonnieren
Ich habe versucht,hackenunten basierend aufErstellen globaler Fußnoten innerhalb einer Miniseite mit Hyperref-Unterstützung, wodurch ich das gleiche Symbol für die Fußnote erhalte, aber nur die letzte Fußnote richtig verknüpft ist.
Anmerkungen:
- Wenn möglich, würde ich es vorziehen,nichtmüssen mehrere Durchläufe machen. Da ein Moment der Fußnote nicht mehrere Durchläufe erfordert, denke ich, dass dies auch ohne das machbar sein sollte.
Verweise:
- Ändern des Fußnotensymbols in mdframed
- Erstellen globaler Fußnoten innerhalb einer Miniseite mit Hyperref-Unterstützung
Code:
\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}
Antwort1
Ich weiß nicht wirklich, was ich tue! Ich sollte schlafen!
Zusätzlich hinzufügen \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}
Ein weiterer hässlicher Hack, um die Symbole in der Fußnote wiederherzustellen
\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}