7

While trying to construct a beamer slide illustrating usage of the \footnote command I hit upon the following problems.

When I compile a slide with the following code:

\documentclass{beamer}
\begin{document}
\begin{frame}[fragile]{Footnotes}
\begin{columns}[t,onlytextwidth]\footnotesize
\begin{column}{0.5\textwidth}
He was a ruffian\footnote{A thug, hoodlum.} to the bone who hated both Alice and White Hare.
\end{column}
\begin{column}{0.5\textwidth}
\begin{semiverbatim}
He was a
ruffian\\footnote\{A thug, hoodlum.\}
to the bone who hated
both Alice and White Hare.
\end{semiverbatim}
\end{column}
\end{columns}
\end{frame}
\end{document}

what I receive is the following slide:

output

So I decided to resort to minipage environment to avoid flushing the code beyond the frame:

\documentclass{beamer}
\begin{document}
\begin{frame}[fragile]{Footnotes}
\begin{columns}[t,onlytextwidth]\footnotesize
\begin{column}{0.5\textwidth}
\begin{minipage}[t]{0.5\textwidth}
He was a ruffian\footnote{A thug, hoodlum.} to the bone who hated both Alice and White Hare.
\end{minipage}
\end{column}
\begin{column}{0.5\textwidth}
\begin{minipage}[t]{0.5\textwidth}
\begin{semiverbatim}
He was a
ruffian\\footnote\{A thug, hoodlum.\}
to the bone who hated
both Alice and White Hare.
\end{semiverbatim}
\end{minipage}
\end{column}
\end{columns}
\end{frame}
\end{document}

Yet in this case, although aligning is OK, the text in the left minipage is squeezed in a way which makes it look rather, say, inelegant:

output

I would like to ask you to help me understand what's going on here and why, and tell me what is best remedy. I know there are beamer packages that are particularly suited for frames like this, but I am curious why these problems arise why I use the tools above.

4
  • I'm not entirely sure what the desired result here is, however I believe that \footnote{A thug, hoodlum.} would be the standard usage (I believe?) in place of \\footnote\{A thug, hoodlum\}.
    – BeUndead
    Mar 10, 2014 at 22:58
  • Yes, \footnote{A thug, hoodlum.} is a standard <code>footnote</code> LaTeX command. Mar 10, 2014 at 23:00
  • My apologies, I missed that it was in the semiverbatim environment. You are correct. As a quick remedy to the problem (will wait for someone better than I to give reason for the result) one could use \footnotemark inside the column, and \footnotetext[1]{A thug, hoodlum.} outside of the columns.
    – BeUndead
    Mar 10, 2014 at 23:05
  • It solves the problem of flushing the inside the right-hand column beyond the frame, but footnote is placed beyond columns, which is not what I try to achieve. I want to place it inside to create a small example of a page with a footnote. Mar 10, 2014 at 23:13

2 Answers 2

3

You have to give a width of \textwidth to the minipage so that it occupies the entire column. Please note that the minipage is inside a column and \columnwidth is \textwidth for that minipage. I have reduced column width slightly (0.47\textwidth) and added a \hfill for clarity.

\documentclass{beamer}

\begin{document}

\begin{frame}[fragile]{Footnotes}
\begin{columns}[t,onlytextwidth]\footnotesize
\begin{column}{0.47\textwidth}
\begin{minipage}[t]{\textwidth}
He was a ruffian\footnote{A thug, hoodlum.} to the bone who hated both Alice and White Hare.
\end{minipage}%
\end{column}
\hfill
\begin{column}{0.47\textwidth}
\begin{minipage}[t]{\textwidth}
\begin{semiverbatim}
He was a
ruffian\\footnote{A thug, hoodlum.}
to the bone who hated
both Alice and White Hare.
\end{semiverbatim}
\end{minipage}
\end{column}
\end{columns}
\end{frame}

\end{document}

enter image description here

1
  • Thanks a lot! I do not know why I thought that declaring \begin{minipage}[t][0.5\textpage] sets width of the minipage, not its content... Mar 10, 2014 at 23:23
4

This is more a suggestion than an answer. As it looks like you are writing a LaTeX tutorial I'd suggest some package which can help you. You are writing a latex code within a verbatim environment to show which code produces the side result. There are some package which just need that you type the code and produce both code and result. Take a look at showexpl or tcolorbox.

Last one provides a tcblisting environment which with a code like

\begin{tcblisting}{title={Footote example}}
He was a ruffian\footnote{A thug, hoodlum.} to the bone who hated both Alice and White Hare.
\end{tcblisting}

produces

enter image description here

And with some options you can obtain a result very similar to your example: enter image description here

The complete code for both figures is:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage[listingsutf8,skins]{tcolorbox}
\usepackage{lipsum}

\begin{document}

\tcbset{listing style={tcblatex,breakindent=0pt}}

\begin{frame}[fragile]{Footnotes}

\begin{tcblisting}{title={Footote example}}
He was a ruffian\footnote{A thug, hoodlum.} to the bone who hated both Alice and White Hare.
\end{tcblisting}

\end{frame}

\begin{frame}[fragile]{Footnotes}

\begin{tcblisting}{enhanced,text side listing,frame hidden,
segmentation hidden,colback=pink,opacityback=0,left=0pt,right=0pt,middle=0pt, top=0pt, bottom=0pt}
He was a ruffian\footnote{A thug, hoodlum.} to the bone who hated both Alice and White Hare. 
\end{tcblisting}
\end{frame}

\end{document}
3
  • Thanks a lot for a hint! I was aware of showexpl but didn't about tcolorbox, which seems very nice. Mar 21, 2014 at 20:35
  • Ignasi, is there an easy way to use tcblisting within overlays? Apr 3, 2014 at 20:36
  • 1
    @MadHatter If you mean the complete box (code and result), yes. But use environments \begin{onlyenv}<1-> ... \end{onlyenv} instead of commands \only<1->{}. If you mean applying overlays to code and result I don't think so, but you can ask here. Thomas F. Sturm (tcolorbox author) is also member of TeX.SX club.
    – Ignasi
    Apr 4, 2014 at 7:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .