逆さまの段落スタイルの脚注

逆さまの段落スタイルの脚注

私は、テキスト内の演習の解答を、逆さまの段落スタイルの脚注としてタイプセットする方法を考えています。次の画像:

ここに画像の説明を入力してください

footmiscオプションを使用すると、ソリューションを右側を上にした段落スタイルの脚注に簡単にタイプセットできますpara。 を使用して、\rotatebox脚注を上下逆さまに、1 行に 1 つずつタイプセットすることもできます (ただし、希望する順序とは逆になります)。ただし、脚注全体が回転する段落スタイルの脚注を取得する方法がわかりません。

次のようなコードを使用して、上記のようなものを作成できるようにしたいと思います。

\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

改訂された OP 要件に対応する新しいバージョン。脚注で中括弧を使いやすくするために、\protected@edefの一部としてを使用するように編集されました。\problem\{...\}

構文 を使用します\problem[]{question}{answer}。この段階で、ユーザーは 2 つの方法のいずれかで脚注を呼び出す必要があります。

  1. \showpageanswers\problem任意のページの末尾に続く、または

  2. 任意のページの\relax最後に、オプションの引数として( 以外) を指定します。\problem

これをページごとに自動化しようとしましたが、失敗しました。

問題カウンターはページごとに引き継がれます。

変更しました\showpageanswers表示する応答がない呼び出しは無視されるように

脚注の長さを 1 行を超えて拡張できるようにするため (つまり段落スタイル)、脚注を に配置しました\parbox。また、脚注のインデントを考慮して、回転した の前に -18pt のカーニングを施し\parbox\strut反転した脚注定義の末尾に を追加しました (\revfootnoteを追加しました。

ただし、複数の回答セットが同じページに表示される場合は、ページごとに 1 つの脚注呼び出しに対してすべての回答を保存すると、順序が間違った脚注が「表示される」のを防ぐことができます (脚注を逆さまにすると、最初と最後の意味が変わるため)。

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}

ここに画像の説明を入力してください

ここに画像の説明を入力してください

答え2

\hfillここでは役に立ちませんが、 は\raggedleft回転したボックスを右端に移動します。

\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}

ここに画像の説明を入力してください

関連情報