如何合并一页上的多个脚注

如何合并一页上的多个脚注


我的问题是,我试图合并页面上的多个脚注。这与以下描述的情况相同:https://tex.stackexchange.com/questions/126981/merging-duplicate-footcites。不幸的是,这个示例对我来说不起作用,这可能是由于使用以下标头导致的:

\documentclass[a4paper,fontsize=12pt,headings=big,chapterprefix,bibliography=totoc,listof=totoc]{scrbook}

\usepackage[automark]{scrpage2}
\usepackage{graphicx}
\usepackage[usenames,dvipsnames]{color} 
\usepackage{units}
\usepackage[utf8]{inputenc}
\usepackage{enumerate}
\usepackage{listings} 
\usepackage[style=authortitle-comp,backref=true,backend=biber,citetracker,pagetracker=page]{biblatex}
\usepackage[babel,german=quotes]{csquotes}
\usepackage[ngerman]{babel} 
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[rightcaption]{sidecap} 
\usepackage{float}
\usepackage{microtype}
\usepackage{titlesec} 
\usepackage[hang,labelfont=bf,font=it]{caption}
\usepackage{subcaption}
\usepackage[section]{placeins}
\usepackage[nottoc]{tocbibind}
\usepackage[nonumberlist,acronym,toc,section]{glossaries} 
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
\usepackage{berasans}
\usepackage[onehalfspacing]{setspace}
\usepackage{tocloft}
\usepackage[a4paper,head=3cm,bottom=25mm,left=3cm,right=2cm]{geometry}
\pagestyle{scrheadings}\pagestyle{plain}
\clearscrheadfoot
\ihead{\headmark}
\ofoot[\pagemark]{\pagemark}

\usepackage[pdftex,bookmarksopen]{hyperref}%,pagebackref


\newcommand{\TODO}[1]{{\color{red}\Large\MakeUppercase{#1}}\newline}
\newcommand{\todo}[1]{\TODO{#1}}


\definecolor{ownblue}{rgb}{0.015686 ,0.25882,0.54901}

\addto\captionsngerman{%
  \renewcommand{\figurename}{Abb.}%
  \renewcommand{\tablename}{Tab.}%
} 

\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}

\graphicspath{{Bilder/}}

\setlength{\captionmargin}{20pt}
\pagestyle{scrheadings}

\setcounter{tocdepth}{2}
\setcounter{secnumdepth}{3}

\renewcommand{\chaptermark}[1]{\markboth{\chapapp\;\thechapter: #1}{}}
\setkomafont{pageheadfoot}{\normalfont\sffamily\bfseries\color{ownblue}}
\setkomafont{pagenumber}{\normalfont\sffamily\bfseries}
\setheadsepline{0.2pt}
\typearea[10mm]{11}

\setkomafont{sectioning}{\sffamily\color{ownblue}}
\setheadwidth{textwithmarginpar}
\renewcommand{\thechapter}{\arabic{chapter}}
\titleformat{\chapter}[display]
{\sffamily\bfseries\color{ownblue}\fontsize{22}{22}\selectfont}
{\filleft\MakeUppercase{\chaptertitlename} \sffamily\fontsize{44}{44}\thechapter}
{2ex}
{\titlerule
\vspace{3ex}
\filright}\renewcommand*\chapterheadstartvskip{\vspace*{2cm}}
\renewcommand{\chaptermark}[1]{\markboth{\chapapp\;\thechapter: #1}{}}

\hypersetup{colorlinks=true, linkcolor=ownblue, filecolor=ownblue, urlcolor=ownblue, citecolor=ownblue, bookmarksnumbered=true}

\newglossary[slg]{symbolslist}{syi}{syg}{Symbolverzeichnis}
\renewcommand*{\glspostdescription}{}
\makeglossaries 

\bibliography{Bericht}

编辑:最小的例子是:

\documentclass[a4paper,fontsize=12pt,headings=big,chapterprefix,bibliography=totoc,listof=totoc]{scrbook}

\usepackage[automark]{scrpage2}
\usepackage{graphicx}
\usepackage[usenames,dvipsnames]{color} 
\usepackage{units}
\usepackage[utf8]{inputenc}
\usepackage{enumerate}
\usepackage{listings} 
\usepackage[style=authortitle-comp,backref=true,backend=biber,citetracker,pagetracker=page]{biblatex}
\usepackage[babel,german=quotes]{csquotes}
\usepackage[ngerman]{babel} 
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[rightcaption]{sidecap} 
\usepackage{float}
\usepackage{microtype}
\usepackage{titlesec} 
\usepackage[hang,labelfont=bf,font=it]{caption}
\usepackage{subcaption}
\usepackage[section]{placeins}
\usepackage[nottoc]{tocbibind}
\usepackage[nonumberlist,acronym,toc,section]{glossaries} 
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
\usepackage{berasans}
\usepackage[onehalfspacing]{setspace}
\usepackage{tocloft}
\usepackage[a4paper,head=3cm,bottom=25mm,left=3cm,right=2cm]{geometry}
\pagestyle{scrheadings}\pagestyle{plain}
\clearscrheadfoot
\ihead{\headmark}
\ofoot[\pagemark]{\pagemark}

\usepackage[pdftex,bookmarksopen]{hyperref}%,pagebackref


\newcommand{\TODO}[1]{{\color{red}\Large\MakeUppercase{#1}}\newline}
\newcommand{\todo}[1]{\TODO{#1}}


\definecolor{ownblue}{rgb}{0.015686 ,0.25882,0.54901}

\addto\captionsngerman{%
  \renewcommand{\figurename}{Abb.}%
  \renewcommand{\tablename}{Tab.}%
} 

\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}

\graphicspath{{Bilder/}}

\setlength{\captionmargin}{20pt}
\pagestyle{scrheadings}

\setcounter{tocdepth}{2}
\setcounter{secnumdepth}{3}

\renewcommand{\chaptermark}[1]{\markboth{\chapapp\;\thechapter: #1}{}}
\setkomafont{pageheadfoot}{\normalfont\sffamily\bfseries\color{ownblue}}
\setkomafont{pagenumber}{\normalfont\sffamily\bfseries}
\setheadsepline{0.2pt}
\typearea[10mm]{11}

\setkomafont{sectioning}{\sffamily\color{ownblue}}
\setheadwidth{textwithmarginpar}
\renewcommand{\thechapter}{\arabic{chapter}}
\titleformat{\chapter}[display]
{\sffamily\bfseries\color{ownblue}\fontsize{22}{22}\selectfont}
{\filleft\MakeUppercase{\chaptertitlename} \sffamily\fontsize{44}{44}\thechapter}
{2ex}
{\titlerule
\vspace{3ex}
\filright}\renewcommand*\chapterheadstartvskip{\vspace*{2cm}}
\renewcommand{\chaptermark}[1]{\markboth{\chapapp\;\thechapter: #1}{}}

\hypersetup{colorlinks=true, linkcolor=ownblue, filecolor=ownblue, urlcolor=ownblue, citecolor=ownblue, bookmarksnumbered=true}

\newglossary[slg]{symbolslist}{syi}{syg}{Symbolverzeichnis}
\renewcommand*{\glspostdescription}{}
\makeglossaries 

\bibliography{Bericht}

\begin{document}

\thispagestyle{empty}

\pagenumbering{arabic}


this\footcite{b1} is\footcite{b2} not\footcite{b1} merged\footcite{b1}

\end{document}

对于 Bericht.tex 文件和 Bericht.bib 文件:

@Article{b1,

  Title                    = {text},

  Author                   = {name1 and name2},

  Journal                  = {paper},

  Year                     = {2014}

}


@Article{b2,

  Title                    = {text2},

  Author                   = {author1 and author2},

  Journal                  = {paper},

  Year                     = {2014}

}

两者都以 UTF-8 存储。我在 Windows 上通过 cygwin 和 mingw 进行“编译”,使用:

pdflatex Bericht
biber Bericht
pdflatex Bericht
pdflatex Bericht

编辑2:最小的不起作用的例子是

\documentclass[a4paper,fontsize=12pt,headings=big,chapterprefix,bibliography=totoc,listof=totoc]{scrbook}

\usepackage[automark]{scrpage2}
\usepackage{graphicx}
\usepackage[usenames,dvipsnames]{color} 
\usepackage{units}
\usepackage[utf8]{inputenc}
\usepackage{enumerate}
\usepackage{listings} 
\usepackage[style=authortitle-comp,backref=true,backend=biber,citetracker,pagetracker=page]{biblatex}
\usepackage[babel,german=quotes]{csquotes}
\usepackage[ngerman]{babel} 
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[rightcaption]{sidecap} 
\usepackage{float}
\usepackage{microtype}
\usepackage{titlesec} 
\usepackage[hang,labelfont=bf,font=it]{caption}
\usepackage{subcaption}
\usepackage[section]{placeins}
\usepackage[nottoc]{tocbibind}
\usepackage[nonumberlist,acronym,toc,section]{glossaries} 
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
\usepackage{berasans}
\usepackage[onehalfspacing]{setspace}
\usepackage{tocloft}
\usepackage[a4paper,head=3cm,bottom=25mm,left=3cm,right=2cm]{geometry}
\pagestyle{scrheadings}\pagestyle{plain}
\clearscrheadfoot
\ihead{\headmark}
\ofoot[\pagemark]{\pagemark}

\usepackage[pdftex,bookmarksopen]{hyperref}%,pagebackref


\newcommand{\TODO}[1]{{\color{red}\Large\MakeUppercase{#1}}\newline}
\newcommand{\todo}[1]{\TODO{#1}}


\definecolor{ownblue}{rgb}{0.015686 ,0.25882,0.54901}

\addto\captionsngerman{%
  \renewcommand{\figurename}{Abb.}%
  \renewcommand{\tablename}{Tab.}%
} 

\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}

\graphicspath{{Bilder/}}

\setlength{\captionmargin}{20pt}
\pagestyle{scrheadings}

\setcounter{tocdepth}{2}
\setcounter{secnumdepth}{3}

\renewcommand{\chaptermark}[1]{\markboth{\chapapp\;\thechapter: #1}{}}
\setkomafont{pageheadfoot}{\normalfont\sffamily\bfseries\color{ownblue}}
\setkomafont{pagenumber}{\normalfont\sffamily\bfseries}
\setheadsepline{0.2pt}
\typearea[10mm]{11}

\setkomafont{sectioning}{\sffamily\color{ownblue}}
\setheadwidth{textwithmarginpar}
\renewcommand{\thechapter}{\arabic{chapter}}
\titleformat{\chapter}[display]
{\sffamily\bfseries\color{ownblue}\fontsize{22}{22}\selectfont}
{\filleft\MakeUppercase{\chaptertitlename} \sffamily\fontsize{44}{44}\thechapter}
{2ex}
{\titlerule
\vspace{3ex}
\filright}\renewcommand*\chapterheadstartvskip{\vspace*{2cm}}
\renewcommand{\chaptermark}[1]{\markboth{\chapapp\;\thechapter: #1}{}}

\hypersetup{colorlinks=true, linkcolor=ownblue, filecolor=ownblue, urlcolor=ownblue, citecolor=ownblue, bookmarksnumbered=true}

\newglossary[slg]{symbolslist}{syi}{syg}{Symbolverzeichnis}
\renewcommand*{\glspostdescription}{}
\makeglossaries 

\bibliography{Bericht}

\DeclareCiteCommand{\superfootcite}[\cbx@wrap]
  {\gdef\cbx@keys{}}
  {\xappto\cbx@keys{\thefield{entrykey},}}
  {}
  {\ifcsundef{cbx@lastin@\cbx@keys @\strfield{postnote}}
     {\csnumgdef{cbx@lastin@\cbx@keys @\strfield{postnote}}{-1}}{}%
   \ifsamepage{\value{instcount}}{\csuse{cbx@lastin@\cbx@keys @\strfield{postnote}}}
     {\footnotemark[\csuse{cbx@lastfn@\cbx@keys @\strfield{postnote}}]}
     {\xappto\cbx@cite{\noexpand\footcite%
        [\thefield{prenote}][\thefield{postnote}]{\cbx@keys}%
        \csnumgdef{cbx@lastfn@\cbx@keys @\strfield{postnote}}{\value{\@mpfn}}%
        \csnumgdef{cbx@lastin@\cbx@keys @\strfield{postnote}}{\value{instcount}}}}}
%removing the next 3 lines leads to the point that it only does not know the superfootcite command
\newrobustcmd{\cbx@wrap}[1]{#1\cbx@cite\gdef\cbx@cite{}}
\def\cbx@cite{}
\makeatother

\begin{document}

\thispagestyle{empty}

\pagenumbering{arabic}


this\superfootcite[]{b1} is\superfootcite[]{b2} not\superfootcite[]{b1} working\superfootcite[]{b1}

\end{document}

答案1

使用链接问题中的代码确实有效:

文本示例

脚部样本

请注意,我使用的\superfootcite是 而不是\footcite。我还将您的\bibliography命令更改为\addbibresource

\documentclass[a4paper,fontsize=12pt,headings=big,chapterprefix,bibliography=totoc,listof=totoc]{scrbook}

\usepackage[automark]{scrpage2}
\usepackage{graphicx}
\usepackage[usenames,dvipsnames]{color} 
\usepackage{units}
\usepackage[utf8]{inputenc}
\usepackage{enumerate}
\usepackage{listings} 
\usepackage[style=authortitle-comp,backref=true,backend=biber,citetracker,pagetracker=page]{biblatex}
\usepackage[babel,german=quotes]{csquotes}
\usepackage[ngerman]{babel} 
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[rightcaption]{sidecap} 
\usepackage{float}
\usepackage{microtype}
\usepackage{titlesec} 
\usepackage[hang,labelfont=bf,font=it]{caption}
\usepackage{subcaption}
\usepackage[section]{placeins}
\usepackage[nottoc]{tocbibind}
\usepackage[nonumberlist,acronym,toc,section]{glossaries} 
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
\usepackage{berasans}
\usepackage[onehalfspacing]{setspace}
\usepackage{tocloft}
\usepackage[a4paper,head=3cm,bottom=25mm,left=3cm,right=2cm]{geometry}
\pagestyle{scrheadings}\pagestyle{plain}
\clearscrheadfoot
\ihead{\headmark}
\ofoot[\pagemark]{\pagemark}

\usepackage[pdftex,bookmarksopen]{hyperref}%,pagebackref


\newcommand{\TODO}[1]{{\color{red}\Large\MakeUppercase{#1}}\newline}
\newcommand{\todo}[1]{\TODO{#1}}


\definecolor{ownblue}{rgb}{0.015686 ,0.25882,0.54901}

\addto\captionsngerman{%
  \renewcommand{\figurename}{Abb.}%
  \renewcommand{\tablename}{Tab.}%
} 

\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}

\graphicspath{{Bilder/}}

\setlength{\captionmargin}{20pt}
\pagestyle{scrheadings}

\setcounter{tocdepth}{2}
\setcounter{secnumdepth}{3}

\renewcommand{\chaptermark}[1]{\markboth{\chapapp\;\thechapter: #1}{}}
\setkomafont{pageheadfoot}{\normalfont\sffamily\bfseries\color{ownblue}}
\setkomafont{pagenumber}{\normalfont\sffamily\bfseries}
\setheadsepline{0.2pt}
\typearea[10mm]{11}

\setkomafont{sectioning}{\sffamily\color{ownblue}}
\setheadwidth{textwithmarginpar}
\renewcommand{\thechapter}{\arabic{chapter}}
\titleformat{\chapter}[display]
{\sffamily\bfseries\color{ownblue}\fontsize{22}{22}\selectfont}
{\filleft\MakeUppercase{\chaptertitlename} \sffamily\fontsize{44}{44}\thechapter}
{2ex}
{\titlerule
\vspace{3ex}
\filright}\renewcommand*\chapterheadstartvskip{\vspace*{2cm}}
\renewcommand{\chaptermark}[1]{\markboth{\chapapp\;\thechapter: #1}{}}

\hypersetup{colorlinks=true, linkcolor=ownblue, filecolor=ownblue, urlcolor=ownblue, citecolor=ownblue, bookmarksnumbered=true}

\newglossary[slg]{symbolslist}{syi}{syg}{Symbolverzeichnis}
\renewcommand*{\glspostdescription}{}
\makeglossaries 

\addbibresource{Bericht.bib}

\makeatletter
\DeclareCiteCommand{\superfootcite}[\cbx@wrap]
  {\gdef\cbx@keys{}}
  {\xappto\cbx@keys{\thefield{entrykey},}}
  {}
  {\ifcsundef{cbx@lastin@\cbx@keys @\strfield{postnote}}
     {\csnumgdef{cbx@lastin@\cbx@keys @\strfield{postnote}}{-1}}{}%
   \ifsamepage{\value{instcount}}{\csuse{cbx@lastin@\cbx@keys @\strfield{postnote}}}
     {\footnotemark[\csuse{cbx@lastfn@\cbx@keys @\strfield{postnote}}]}
     {\xappto\cbx@cite{\noexpand\footcite%
        [\thefield{prenote}][\thefield{postnote}]{\cbx@keys}%
        \csnumgdef{cbx@lastfn@\cbx@keys @\strfield{postnote}}{\value{\@mpfn}}%
        \csnumgdef{cbx@lastin@\cbx@keys @\strfield{postnote}}{\value{instcount}}}}}

\newrobustcmd{\cbx@wrap}[1]{#1\cbx@cite\gdef\cbx@cite{}}
\def\cbx@cite{}

\makeatother

\begin{document}

\thispagestyle{empty}

\pagenumbering{arabic}


This\superfootcite{b1} is\superfootcite{b2} really\superfootcite{b1} merged\superfootcite{b1}.

\end{document}

相关内容