Page LayoutPut footnotes at the bottom of margin

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
abclatex
Posts: 17
Joined: Wed Nov 28, 2012 10:09 pm

Put footnotes at the bottom of margin

Post by abclatex »

All the footnotes need to be put together at the bottom of margin like this way:

sample of footnote.JPG
sample of footnote.JPG (57.65 KiB) Viewed 10464 times
I already used \usepackage[side,flushmargin]{footmisc} to put all footnotes at the margin area, but they parallel to noted texts.

so how can I make them looks like the above sample?

These are my codes:

Code: Select all

\documentclass[10pt,a4paper]{book}
\textwidth=11cm
\textheight=25cm
\marginparsep=1cm

\usepackage{fancyhdr}
\pagestyle{plain}
\renewcommand{\headrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0.4pt}
\renewcommand\thepage{{\large\arabic{page}}}

\usepackage{geometry}
\geometry{left=2cm,right=7cm,top=2cm,bottom=2cm}

\usepackage[side,flushmargin]{footmisc}
\usepackage{morefloats}
\usepackage[german,french]{babel}


\begin{document}
\frontmatter
\begin{flushleft}
\thispagestyle{empty}
\pagenumbering{Roman}
\mainmatter



\chapter{chapter1}
"Chasing Pavements"

I've made up my mind,

Don't need to think it over\footnote{adele1}

If I'm wrong, I am right

Don't need to look no further\footnote{adele1}

This ain't lust

I know this is love

But, if I tell the world\footnote{adele1}

I'll never say enough

'cause it was not said to you

And that's exactly what I need to do

If I end up with you\footnote{adele1}


\section{section1}
[Chorus]
Should I give up,\footnote{Or should I give up,Or should I just keep chasin' pavements}

Or should I just keep chasin' pavements?

Even if it leads nowhere

Or would it be a waste

Even if I knew my place\footnote{Even if it leads nowhere}

Should I leave it there

Should I give up,

Or should I just keep chasin' pavements \footnote{Or would it be a waste. Even if I knew my place. Should I leave it there}

Even if it leads nowhere

I build myself up

And fly around in circles\footnote{Or would it be a waste. Even if I knew my place. Should I leave it there}

Waitin' as my heart drops

And my back begins to tingle\footnote{Or would it be a waste. Even if I knew my place. Should I leave it there}


Finally, could this be it

[Chorus]

Or would it be a waste

Even if I knew my place

Should I leave it there\footnote{Or would it be a waste. Even if I knew my place. Should I leave it there}

Should I give up

Or should I just keep chasin' pavements

Even if it leads nowhere

Or would it be a waste

Even if I knew my place should I leave it there

Should I give up

Or should I just keep on chasin' pavements

Should I just keep on chasin' pavements

Ohh oh


\backmatter
\end{flushleft}
\end{document}



This is the outcome of my codes:
current outcome (footnote).JPG
current outcome (footnote).JPG (22.84 KiB) Viewed 10461 times
Thanks a lot!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Put footnotes at the bottom of margin

Post by cgnieder »

Hi abclatex and welcome to the LaTeX community.

What you want is a none-trivial task. However, there are some solutions. Have a look at the question Send (and stack) \marginpar to the top or the bottom of the page and its answers at TeX.sx, especially the answer by Heiko Oberdiek.

Regards
site moderator & package author
abclatex
Posts: 17
Joined: Wed Nov 28, 2012 10:09 pm

Re: Put footnotes at the bottom of margin

Post by abclatex »

Thank you, cgnieder.

I've looked through "Send (and stack) \marginpar to the top or the bottom of the page" by Heiko Oberdiek.

But, a number counter and space adjusting need to done later. So I wonder if there is easy way to solve it via footnote instead of marginpar.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Put footnotes at the bottom of margin

Post by cgnieder »

Have you also looked at the adapted self-answer by Mathieu? It provides (nearly) everything you need.

I have taken his code and added these lines:

Code: Select all

\makeatletter
\renewcommand\footnote[1]{%
  \footnotemark\footmarginnote{\textsuperscript{\@thefnmark}\,#1}}
\makeatother
Now the complete code looks as follows:

Code: Select all

\documentclass{article}

\usepackage[%
    a4paper,
    left=2cm,
    textheight=24cm,
    textwidth=10cm,
    marginparsep=2cm,
    marginparwidth=5cm
    ]{geometry}

\usepackage{forarray,etoolbox,xifthen,,graphicx,picture,calc,atbegshi,lipsum,color}

\newlength{\vincrement}

\newlength{\fmvorigin}
\newlength{\fmhorigin}
\newlength{\fmvoffset}
\newlength{\nextfmvoffset}
\newlength{\fmvskip}

\setlength{\fmvorigin}{-1in-\voffset-\topmargin-\headheight-\headsep-\textheight}
\makeatletter
    \ifthenelse{\isundefined{\Gm@lmargin}}%
    {\setlength{\fmhorigin}{1in+\hoffset+\oddsidemargin+\textwidth+\marginparsep}}%
    {\setlength{\fmhorigin}{\Gm@lmargin+\textwidth+\marginparsep}}
\makeatother
\setlength{\fmvoffset}{0pt}
\setlength{\fmvskip}{3ex}

\newlength{\tmvorigin}
\newlength{\tmhorigin}
\newlength{\tmvoffset}
\newlength{\nexttmvoffset}
\newlength{\tmvskip}
\newlength{\maxtmnheight}

\setlength{\tmvorigin}{-1in-\voffset-\topmargin-\headheight-\headsep-\baselineskip}
\setlength{\tmhorigin}{\fmhorigin}
\setlength{\tmvoffset}{0pt}
\setlength{\tmvskip}{6ex}

\newcounter{fmn}
\newcounter{tmn}

\newboolean{marginisfull}

\newcommand{\fmnbuffer}{}
\newcommand{\currentfmnqueue}{}
\newcommand{\nextfmnqueue}{}

\newcommand{\tmnbuffer}{}
\newcommand{\currenttmnqueue}{}
\newcommand{\nexttmnqueue}{}

\newcommand{\append}[2]{%
    \ifdefempty{#1}{}{\eappto{#1}{,}}%
    \eappto{#1}{#2}%
    }

\newcommand{\prepend}[2]{%
    \ifdefempty{#1}{}{\epreto{#1}{,}}%
    \epreto{#1}{#2}%
    }

\newcommand{\footmarginnote}[1]{%
    \addtocounter{fmn}{1}%
    \expandafter\newsavebox\csname fmnbox\roman{fmn}\endcsname%
    \expandafter\savebox\csname fmnbox\roman{fmn}\endcsname{\parbox[b]{\marginparwidth}{#1}}%
    \append{\currentfmnqueue}{\roman{fmn}}%
    }

\newcommand{\topmarginnote}[1]{%
    \addtocounter{tmn}{1}%
    \expandafter\newsavebox\csname tmnbox\roman{tmn}\endcsname%
    \expandafter\savebox\csname tmnbox\roman{tmn}\endcsname{\parbox[t]{\marginparwidth}{\vskip-0.75\baselineskip#1}}%
    \append{\currenttmnqueue}{\roman{tmn}}%
    }

\newcommand{\printfmn}{%
    \setlength{\fmvoffset}{0pt}%
    \setboolean{marginisfull}{false}%
    \ifdefempty{\currentfmnqueue}{}{%
        \gdef\nextfmnqueue{}%
        \gdef\fmnbuffer{}%
        \ForEachX{,}{%
            \ifthenelse{\boolean{marginisfull}}%
                {\append{\nextfmnqueue}{\thislevelitem}}%
                {%
                \setlength{\vincrement}%
                    {\fmvskip+\expandafter\ht\csname fmnbox\thislevelitem\endcsname+\dp\csname fmnbox\thislevelitem\endcsname}%
                \setlength{\nextfmvoffset}{\fmvoffset+\vincrement}%
                \ifthenelse{\lengthtest{\nextfmvoffset>\textheight}}{%
                    \setboolean{marginisfull}{true}%
                    \append{\nextfmnqueue}{\thislevelitem}%
                    }{%
                    \prepend{\fmnbuffer}{\thislevelitem}%
                    \addtolength{\fmvoffset}{\vincrement}%
                    }%
                }%
            }%
            {\currentfmnqueue}%
        \setlength{\fmvoffset}{0pt}%
        \ForEachX{,}{%
            \put(\fmhorigin,\fmvorigin+\fmvoffset){\expandafter\usebox\csname fmnbox\thislevelitem\endcsname}%
            \setlength{\vincrement}%
                {\fmvskip+\expandafter\ht\csname fmnbox\thislevelitem\endcsname+\dp\csname fmnbox\thislevelitem\endcsname}%
            \addtolength{\fmvoffset}{\vincrement}%
            }%
            {\fmnbuffer}%
        \global\let\currentfmnqueue\nextfmnqueue%
        }%
    }

\newcommand{\printtmn}{%
    \setlength{\maxtmnheight}{\textheight-\fmvoffset}%
    \setlength{\tmvoffset}{0pt}%
    \setboolean{marginisfull}{false}%
    \ifdefempty{\currenttmnqueue}{}{%
        \gdef\nexttmnqueue{}%
        \gdef\tmnbuffer{}%
        \ForEachX{,}{%
            \ifthenelse{\boolean{marginisfull}}%
                {\append{\nexttmnqueue}{\thislevelitem}}%
                {%
                \setlength{\vincrement}%
                    {\tmvskip+\expandafter\ht\csname tmnbox\thislevelitem\endcsname+\dp\csname tmnbox\thislevelitem\endcsname}%
                \setlength{\nexttmvoffset}{\tmvoffset+\vincrement}%
                \ifthenelse{\lengthtest{\nexttmvoffset>\maxtmnheight}}{%
                    \setboolean{marginisfull}{true}%
                    \append{\nexttmnqueue}{\thislevelitem}%
                    }{%
                    \append{\tmnbuffer}{\thislevelitem}%
                    \addtolength{\tmvoffset}{\vincrement}%
                    }%
                }%
            }%
            {\currenttmnqueue}%
        \setlength{\tmvoffset}{0pt}%
        \ifdefempty{\tmnbuffer}{}{%
            \ForEachX{,}{%
                \put(\tmhorigin,\tmvorigin-\tmvoffset){\expandafter\usebox\csname tmnbox\thislevelitem\endcsname}%
                \setlength{\vincrement}%
                    {\tmvskip+\expandafter\ht\csname tmnbox\thislevelitem\endcsname+\dp\csname tmnbox\thislevelitem\endcsname}%
                \addtolength{\tmvoffset}{\vincrement}%
                }%
                {\tmnbuffer}%
            }%
        \global\let\currenttmnqueue\nexttmnqueue%
        }%
    }

\AtBeginShipout{\AtBeginShipoutUpperLeft{\printfmn\printtmn}}

\makeatletter
\renewcommand{\footnote}[1]{\footnotemark\footmarginnote{\textsuperscript{\@thefnmark}\,#1}}
\makeatother

\begin{document}
Text\footnote{This is the first footnote.} \lipsum[1]
Text\footnote{This is the second and somewhat longer footnote.} \lipsum[1]
Text\footnote{This is the third footnote.} \lipsum[1]
Text\footnote{This is the fourth footnote.} \lipsum[1]
\end{document}
bottomsidenotes.png
bottomsidenotes.png (34.37 KiB) Viewed 10446 times
Regards
site moderator & package author
abclatex
Posts: 17
Joined: Wed Nov 28, 2012 10:09 pm

Re: Put footnotes at the bottom of margin

Post by abclatex »

It's awesome!!
I didn't find it.
Many thanks to you, cgnieder. Schoenes Wochenende!
magical marshmallow
Posts: 30
Joined: Mon Jan 21, 2013 11:37 am

Put footnotes at the bottom of margin

Post by magical marshmallow »

Hey,

I'm trying to do a similar thing in that I want my footnotes to appear below a footrule in the bottom margin. I am using the footmisc package to suppress the short foot note rule that autogenerates when a footnote is inserted.

Using my current setup, the explanaitons occur above the footrule which looks atrocious.

Ideally I would have a standard space between the bottom of my text and the footrule, and then the same gap again to the footnote explanation.

Does anyone have any ideas what to do as I have none?

Cheers

Code: Select all

\documentclass[11pt,a4paper,numbers=noenddot]{scrreprt}
\usepackage[english]{babel}
\usepackage[top=2cm,headsep=1.25cm,bottom=2.25cm,footskip=0.5cm,left=2.54cm,right=2.54cm]{geometry}
\usepackage{fancyhdr}
        \pagestyle{fancy}
       	\renewcommand{\footrulewidth}{0.3pt}
\usepackage[perpage,symbol,norule]{footmisc}
\begin{document}
Some text with a footnote\footnote{footnote}
\end{document}
Post Reply