12

I am trying to figure out how to typeset solutions to in-text exercises as an upside down, paragraph style footnote, as in the following image:

enter image description here

I can easily typeset the solutions in a rightside up paragraph style footnote using footmisc with the para option. I can also use a \rotatebox to typeset the footnotes upside down and one-per-line (albeit, in the reverse order from what I want). However, I can't figure out how to get paragraph style footnotes in which the entire footnote is rotated.

I'd like to be able to produce something that looks like the above using code such as:

\documentclass[12pt]{article}
\usepackage{graphicx}
\newcommand{\problem}[2]{...}{...}
\begin{document}
\problem{What is 1+1}{two}
\problem{What is 1+2}{three}
\problem{What is 1+3}{four}
\problem{What is 1+4}{five}
\end{document}
  • 1
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Adam Liter Feb 20 '15 at 3:36
  • I would be happy to produce a MWE, but I am not sure what a MWE that isn't also an answer to my question would look like. – henry Feb 20 '15 at 3:42
  • Even an MWE with what you have tried so far would be useful. It doesn't necessarily have to be 'working' in the sense that it achieves what you're trying to do; it should just be 'working' in the sense that it gives people a place to start with helping you. So even the code that produces the image you've uploaded would be helpful. – Adam Liter Feb 20 '15 at 3:47
9

NEW VERSION to respond to revised OP requirements. EDITED to use a \protected@edef as part of \problem to facilitate the use of braces \{...\} in the footnotes.

It uses the syntax \problem[]{question}{answer}. At this stage, the user must invoke the footnotes in one of two ways:

  1. \showpageanswers following the final \problem on any given page; or

  2. provide anything (other than \relax) as an optional argument to the last \problem on any given page.

I tried to automate this on a page-by-page basis, but was unsuccessful.

The problem counter will carry over page to page.

I modified \showpageanswers so than its invocation without any answers to show will be ignored.

To get the footnote to be able to extend past a single line in length (i.e., paragraph style), I put it in a \parbox. I also kerned -18pt before the rotated \parbox, to account for the footnote indent, and added a \strut to end of inverted footnote definition (\revfootnote), for subsequent vertical spacing.

Note however, if multiple answer sets appear on the same page, saving all the answers for one single footnote invocation per page will prevent the "appearance of" misordered footnotes (since turning them upside down changes the sense of first and last).

Here is the MWE

\documentclass[12pt]{article}
\usepackage{graphicx,lipsum}
\usepackage{enumitem}\newsavebox\fnbox
\def\pageanswers{}
\newcounter{problemNo}
\makeatletter
\newcommand\problem[3][\relax]{%
  \stepcounter{problemNo}%
  \par\smallskip%
  \theproblemNo.~~#2?%
  \par\smallskip%
  \protected@edef\pageanswers{\pageanswers$^{\theproblemNo}$#3\ \quad}%
  \ifx\relax#1\else\showpageanswers\fi%
}
\makeatother
\newcommand\showpageanswers{\if\relax\pageanswers\relax\else%
  \revfootnote{\pageanswers}\def\pageanswers{}\fi}
\newcommand\revfootnote[1]{\renewcommand{\thefootnote}{}%
  \footnotetext{\savebox\fnbox{\parbox{%
  \dimexpr\textwidth\relax}{#1\strut}}\kern-18pt%
  \rotatebox{180}{\usebox{\fnbox}}}}
\begin{document}
Solve these problems.
\problem{What is 1+1}{two $\{abc\}$}
\problem{What is 1+2}{three}
\problem{What is 1+3}{four}
\problem{What is 1+4}{five}
\problem{What is 1+5}{six}
\problem{What is 1+6}{seven}
\problem{What is 1+7}{eight}
\problem{What is 1+8}{nine}
\lipsum[1]
\problem{What is 2+1}{three}
\problem{What is 2+2}{four}
\problem{What is 2+3}{five}
\problem[x]{What is 2+4}{six}

\lipsum[2-4]
Solve these problems.
\problem{What is 1+1}{two}
\problem{What is 1+2}{three}
\problem{What is 1+3}{four}
\problem{What is 1+4}{five}
\problem{What is 1+5}{six}
\problem{What is 1+6}{seven}
\problem{What is 1+7}{eight}
\problem[x]{What is 1+8}{nine}
\lipsum[5-8]
\end{document}

enter image description here

enter image description here

  • Darthvader would say: Most impressive ;-) – user31729 Feb 20 '15 at 12:26
  • 1
    @ChristianHupfer "We meet again at last. The circle is now complete... Join me, and together we can rule the galaxy." – Steven B. Segletes Feb 20 '15 at 12:43
  • Give in to your anger ;-) – user31729 Feb 20 '15 at 12:43
  • 1
    I think I shot myself in the foot by providing an MWE that shows how I mimicked the effect that I want for illustrative purposes, as it ended up soliciting other attempts to mimic the effect. To be clear, I am looking for something that typesets footnotes as in footmisc with the [para] option, but rotates the entire footnote box. For example, if a problem overflows onto the next page, its solution should automatically follow it. – henry Feb 20 '15 at 12:50
  • @henry Please look at my revised solution, to see if this better meets your needs. – Steven B. Segletes Feb 20 '15 at 13:04
5

The \hfill is of no use here, but a \raggedleft will shift the rotated box to the right margin`

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{enumitem}
\begin{document}
What is
\begin{enumerate}
\item   1+1?
\item   1+2?
\item   1+3?
\item   1+4?
\end{enumerate}
\renewcommand{\thefootnote}{}
\footnotetext{\raggedleft\rotatebox{180}{$^1$ two\qquad $^2$ three\qquad $^3$ four\qquad $^4$ five\hfill}}
\end{document}

enter image description here

  • looks nice, but it's cheating. – barbara beeton Feb 20 '15 at 13:43
  • 1
    @barbarabeeton: Better cheated than nothing ;-) But the OP changed the question somehow, so my 'solution' is none actually :-( – user31729 Feb 20 '15 at 21:23
  • hmmm. weak excuse. the original question, if read closely, did imply that he wanted to be able to generate the footnotes as paragraphed footnotes and then rotate the whole box. (i think your code may be what the op used to get the original visual. it's a tricky problem!) see henry's comment following the answer by steven segletes. – barbara beeton Feb 20 '15 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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