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.

This question led to a new package:
footnoterange

I have a series of consecutively numbered footnotes that appear as (1,2,...,N). I would like these to be condensed to a hyphenated series consisting of only the first and last member of the series (1–N), analogous to the behavior of the cite and natbib packages for consecutively-numbered bibliographic references. I have loaded the package footmisc to enable proper display of consecutive footnotes, but this package appears to only support comma delineation (and not hyphenation) of footnote lists (cf. footmisc manual).

Edit: I have added three MWEs to make my intentions clear. MWE1 shows the default LaTeX behavior. MWE2 shows the improvements afforded by invocation of \usepackage[multiple]{footmisc}. MWE3 shows the desired outcome.

MWE1 (default):

enter image description here

MWE2 (footmisc):

enter image description here

MWE3 (desired):

enter image description here

The source codes are included here:

MWE1 (default):

\documentclass{article}
\usepackage[hmargin=1in,vmargin=4.75in]{geometry}
\begin{document}
This text bears a multiplicity of footnotes%
\footnote{Lorum}\footnote{ipsum}\footnote{dolor}%
\footnote{sit}\footnote{amet,}\footnote{consectetur}%
\footnote{adipisicing}\footnote{elit}.%
\end{document}

MWE2 (footmisc):

\documentclass{article}
\usepackage[hmargin=1in,vmargin=4.75in]{geometry}
\usepackage[multiple]{footmisc}
\begin{document}
This text bears a multiplicity of footnotes%
\footnote{Lorum}\footnote{ipsum}\footnote{dolor}%
\footnote{sit}\footnote{amet,}\footnote{consectetur}%
\footnote{adipisicing}\footnote{elit}.%
\end{document}

MWE3 (desired):

\documentclass{article}
\usepackage[hmargin=1in,vmargin=4.75in]{geometry}
\begin{document}
This text bears a multiplicity of footnotes$^{1\textrm{--}8}.$%
\footnotetext[1]{Lorum}\footnotetext[2]{ipsum}\footnotetext[3]{dolor}%
\footnotetext[4]{sit}\footnotetext[5]{amet,}\footnotetext[6]{consectetur}%
\footnotetext[7]{adipisicing}\footnotetext[8]{elit}%
\end{document}
share|improve this question
add comment

2 Answers 2

up vote 12 down vote accepted

If you want to give the references to a range of footnotes, the footnoterange environment of the footnoterange package is the obvious choice:

\documentclass{article}
% load hyperref or footmisc or other packages here
% hyperref-option hyperfootnotes=true or =false as you like
% if you use the cleverref package:
%  it must be loaded after hyperref, never before hyperref
\usepackage{footnoterange}
\begin{document}
This text bears a multiplicity of footnotes%
\begin{footnoterange}%
\footnote{Lorum}\footnote{ipsum}\footnote{dolor}%
\footnote{sit}\footnote{amet,}\footnote{consectetur}%
\footnote{adipisicing}\footnote{elit}%
\end{footnoterange}%
 which are referenced as one footnoterange.
\end{document}

Use the footnoterange* environment, if you use the hyperref package with option hyperfootnotes=true but without wanting hyperlinked footnotes. [As for a truly automatic solution without the need for \begin{footnoterange} and \end{footnoterange}: Sorry! That's too tricky. See also Incompatibility between footmisc-option multiple and hyperref asking for more automatic footnote-handling.]

share|improve this answer
    
Thanks Stephen. The code you have posted triggers an undefined control sequence error pertaining to cref macros. I believe this is because my cleveref version (0.14.2, 22/09/2009) is dated, as Mico has suggested. I will have to upgrade this package and try again. –  user001 Feb 11 '12 at 16:40
    
Your code is certainly a step in the correct direction. How can I insert a new line between the footnotes? I routinely encounter the caveat that something will not work with hyperref. Do you know why this is? Presumably the hyperref package maintainers are aware of this and are trying to fix it (?). Or maybe it is an intrinsic and unavoidable problem associated with hyperlinking, and cannot be resolved by source code alterations (?). Why is your code incompatible with hyperref? What is the function of the code you inserted from hyperref in the custom rangefootnote macro? Thanks! –  user001 Feb 12 '12 at 1:46
    
@user001: It did not work with hyperref because of a stupid mistake in my code: hyperref must be loaded before cleveref but I used it afterwards! Now corrected. About the code-lines of hyperref: The package uses its own counter for footnotes, which is not increased automatically when using \footnotetext. Further its Readme says: "The footnote support is rather limited. It is beyond the scope to use \footnotemark and \footnotetext out of order or reusing \footnotemark. Here you can either disable hyperref’s footnote support by "hyperfootnotes=false" or" ... (to be continued) –  Stephen Feb 12 '12 at 14:25
    
(continuation) ... "fiddle with internal macros". And that is what the code does, thereby getting the numeration/hyperlinks right. –  Stephen Feb 12 '12 at 14:27
1  
Using the para option with the footmisc package prints the footnotes in one "paragraph". Without that option, each footnote begins in a new line/paragraph. –  Stephen Feb 13 '12 at 19:04
show 7 more comments

I suggest you look into the cleveref package and its commands \crefrange and \cref. The former commands takes two arguments, the first and last label of a range of items to be cross-referenced; with the second command, you just specify all labels that are to be cross-referenced, and the package will sort and, if possible, compress the list automatically. The arguments of the \cref command needn't even be in any order.

The following MWE illustrates how this may be done.

\documentclass{article}
\usepackage[para]{footmisc} % since you mention that you use this package
\usepackage{cleveref}
  \newcommand\crefrangeconjunction{--}      % default: " to "
  \newcommand{\creflastconjunction}{, and } % default: " and ", i.e., without the comma
\begin{document}
\section{Hey, let's create some footnotes}
Once\footnote{A \label{fn:A}} upon\footnote{B \label{fn:B}} a\footnote{C \label{fn:C}} time,\footnote{D \label{fn:D}} there\footnote{E \label{fn:E}} was\footnote{F \label{fn:F}} \ldots

\section{Now let's cross-reference these footnotes}   
As is demonstrated in \crefrange{fn:A}{fn:F}, \ldots

\noindent
As additionally noted in \cref{fn:F,fn:A,fn:D,fn:E,fn:B}, \ldots
\end{document}

enter image description here enter image description here

Of course, the cleveref package's cross-referencing commands work not only with footnotes, but with just about all items that can be given a label -- equations, sections, figures, tables, algorithms, and so on.

Finally, be sure to have the latest version of the cleveref package on your system, as the package has recently been updated and upgraded significantly by its author. For instance, the \creflastconjunction macro that's used in the MWE probably won't work unless you have a recent version of the package.

share|improve this answer
    
I think that with "consecutive footnotes" the OP means several \footnote commands issued consecutively (without any intervening text). The footmisc package allows for adding a comma between the respective footnote marks. –  lockstep Feb 11 '12 at 13:12
    
@lockstep: OK, I may have completely misunderstood the OP's intent! Let's see what he/she has to add. –  Mico Feb 11 '12 at 13:16
    
Thank you for your suggestions, Mico. As @lockstep suggested, my question does relate to consecutive placement of multiple footnotes at the same spot, rather than subsequently cross-referencing groups of footnotes. I have amended the original post with MWEs to make this intention clear. –  user001 Feb 11 '12 at 14:15
add 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.