Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Footnote counters can be reset in each page by using either zref-perpage or perpage packages but how do you reset footnote counter in each column of a two column documents?

\documentclass[twocolumn]{article}
\usepackage{zref-perpage}
\zmakeperpage{footnote}
\begin{document}
This is a test\footnote{Test}
\newpage
This is a test\footnote{Test}
\end{document}
share|improve this question
    
I doubt that this problem is solvable without an adapted output routine - which makes it hard; multicol might be a start. –  Martin Schröder Nov 5 '12 at 14:57
    
@MartinSchröder that, or saving some information in the .aux file and having to re-run ;) –  tohecz Nov 13 '12 at 21:57
add comment

3 Answers

I have a solution that works in combination with

With the help of etoolbox's \preto each time \footnote is called it is checked wether it is used in the first or second column. If it is in the second column the footnote counter is reset if it hasn't been reset before. For this a new conditional is used that is set to true after the resetting and set to false again in the first column.

Although this worked nicely in my tests it might have drawbacks I'm not aware of.

\documentclass[twocolumn]{article}
\usepackage[perpage]{footmisc}
% or
% \usepackage{zref-perpage}
% \zmakeperpage{footnote}
% or
% \usepackage{perpage}
% \MakePerPage{footnote}

\usepackage{lipsum}% dummy text
\usepackage{etoolbox}
\makeatletter
\newif\iffootnoteresetted
\preto\footnote{%
  \if@firstcolumn
    \footnoteresettedfalse
  \else
    \iffootnoteresetted\else
      \setcounter{\@mpfn}{0}%
      \footnoteresettedtrue
    \fi
  \fi
  }{}{}
\makeatother
\begin{document}
This is a test\footnote{Test}
This is a test\footnote{Test}
\lipsum[1-4]
This is a test\footnote{Test}
This is a test\footnote{Test}
\lipsum[1-4]
This is a test\footnote{Test}
This is a test\footnote{Test}
\newpage
This is a test\footnote{Test}
This is a test\footnote{Test}
\end{document}

enter image description here

share|improve this answer
    
It should work quite well, I'm just not sure about the behaviour in a paragraph that breaks over both columns, because it's first processed and only then broken into lines and pages... –  tohecz Nov 2 '12 at 23:21
2  
That's a possible failure I would think. –  cgnieder Nov 3 '12 at 8:18
    
I wonder if anyone has the insight if and how there is a way around. I was not able to understand the parts of the kernel where the splitting in two cloumns takes places well enough to find a satisfying solution. –  cgnieder Nov 6 '12 at 19:57
    
Yeah, there surely is. Remember that titlesec has the option [left], [right] and through the .aux file it remembers the real position of the sectioning command. The same thing must be possible for footnotes as well. –  tohecz Nov 6 '12 at 21:40
    
That's what I thought and (unsuccessfully) experimented with… –  cgnieder Nov 7 '12 at 11:14
add comment

To show the drawback I speak about, it's too long for a comment.

\documentclass[a4paper,twocolumn]{article}
\usepackage{lipsum}
\makeatletter
\let\@ORG@makecol\@makecol
\gdef\@makecol{\setcounter{footnote}{0}\@ORG@makecol}
\makeatother

\begin{document}

\def\TEST{
This is a test. \footnote{Begin}
This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. \footnote{End} This is a test.\par
}

\TEST\TEST\TEST\TEST\TEST\TEST\TEST\TEST
\TEST\TEST\TEST\TEST\TEST\TEST\TEST\TEST

\end{document}
share|improve this answer
add comment
up vote 0 down vote accepted

footnote counter needs to be reset at the beginning of \@makecol macro:

\documentclass[twocolumn]{article}
\usepackage{lipsum}
\makeatletter
\let\@ORG@makecol\@makecol
\gdef\@makecol{\setcounter{footnote}{0}\@ORG@makecol}
\makeatother

\begin{document}
This is a test\footnote{Test}
This is a test\footnote{Test}
\lipsum[1-4]
This is a test\footnote{Test}
This is a test\footnote{Test}
\lipsum[1-4]
This is a test\footnote{Test}
This is a test\footnote{Test}
\newpage
This is a test\footnote{Test}
This is a test\footnote{Test}
\end{document}
share|improve this answer
    
This has the very same drawback as the solution by cgnieder: I won't work in a footnote in paragraph having a pagebreak. –  tohecz Nov 4 '12 at 13:23
    
@tohecz: I doubt about the truth of your statement. –  Vafa Nov 4 '12 at 14:20
    
Try my CW answer. –  tohecz Nov 4 '12 at 14:33
5  
@Vafa just replace the first three lines of your document body with This is a test\footnote{Test}\lipsum[1-3] This is a test\footnote{Test} and you'll see that @tohecz is right. –  cgnieder Nov 4 '12 at 14:40
    
Sorry, but I had to downvote this answer. I have no problem with answers being wrong, but I do have a problem with people not willing to admit it. –  tohecz Nov 5 '12 at 11:09
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.