
私はmdframed
アイテムの大きなリストを表示するためにを使用しています。このリストには、1ついくつかの項目には例外があり、私は脚注でこれを書き留めようとしています。脚注のテキストは同じです全て例外です。私が望むのは次のようなものです。
- 同じ記号を使用した複数の脚注(各 mdframed 内)
- 各脚注にリンクするには1つ末尾のテキストそれぞれmdframed
私は試しましたハック以下に基づいてハイパーリファレンスサポートを使用してミニページ内にグローバル脚注を作成する、これにより、脚注に同じシンボルが表示されますが、最後の脚注のみが正しくリンクされます。
ノート:
- 可能であれば、ない複数回実行する必要があります。脚注の 1 つのインスタンスでは複数回の実行は必要ないため、複数回の実行がなくても実行できると思います。
参考文献:
コード:
\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}