Можете ли вы подсказать мне другое решение, как разместить строку текста внизу страницы?

Можете ли вы подсказать мне другое решение, как разместить строку текста внизу страницы?

Я пишу класс документа, в котором я хочу поместить строку текста в нижней части текстовой области, после сносок, чтобы ее место всегда было полностью зафиксировано. Решение для этого следующее:

\documentclass{article}
\usepackage{lipsum,graphicx}
\title{A sample title}
\author{John Doe}

\makeatletter
\def\@maketitle{%
\newpage
\null
\vskip 2em%
\begin{center}%
\let \footnote \thanks
{\LARGE \@title \par}%
\vskip 1.5em%
{\large
\lineskip .5em%
\begin{tabular}[t]{c}%
\@author
\end{tabular}\par}%
\vskip 1em%
{\large \@date}%
\end{center}%
\begin{figure}[!b]
\copyright\ 2022 John Doe \hfill Department of Mathematics
\end{figure}
\par
\vskip 1.5em
}
\makeatother

\begin{document}
\maketitle
Text goes here\footnote{A footnote} and\footnote{Another footnote}
\lipsum[2]
\end{document}

Но по некоторым причинам я не хочу использовать среду float. Можете ли вы предложить мне другое решение (желательно без загрузки дополнительных пакетов)?

решение1

Есть возможности для абсолютного позиционирования текста на странице. Например, tikz предоставляет средства для этого.


Если используется последняя версия LaTeX, в которой доступны хуки shipout, вы можете добавить код в хук shipout/foreground.

Хук shipout/foregroundссылается на среду изображения с верхним левым углом (0,0) в верхнем левом углу страницы и единичной длиной 1 пт.
(Чтобы что-то происходило на странице, компоненты координат y-/second должны быть отрицательными. С последним релизом LaTeX в среде pictureзабота о нормализации \dimexprи регистрах длины \unitlengthне требуется, поскольку это делается автоматически.)

\documentclass[twoside]{article}

\csname @ifundefined\endcsname{pagewidth}{}{\pagewidth=\paperwidth}%
\csname @ifundefined\endcsname{pdfpagewidth}{}{\pdfpagewidth=\paperwidth}%
\csname @ifundefined\endcsname{pageheight}{}{\pageheight=\paperheight}%
\csname @ifundefined\endcsname{pdfpageheight}{}{\pdfpageheight=\paperheight}%

\usepackage{lipsum}
\title{A sample title}
\author{John Doe}

\makeatletter
\newcommand\foo[1]{#1}
\def\@maketitle{%
\newpage
% If you want this on the titlepage only, use \AddToHookNext instead of \AddToHook
\AddToHook{shipout/foreground}{%
  \put(\dimexpr 1in+\ifodd\thepage\oddsidemargin\else\evensidemargin\fi\relax,
       \foo{\dimexpr-\paperheight+.5\dimexpr\paperheight-(1in+\topmargin+\headheight+\headsep+\textheight+\footskip)+\ht\strutbox\relax\relax})%
  {%
    \hbox to\textwidth{\copyright\ 2022 John Doe \hfill Department of Mathematics}%
  }%
}
\null
\vskip 2em%
\begin{center}%
\let \footnote \thanks
{\LARGE \@title \par}%
\vskip 1.5em%
{\large
\lineskip .5em%
\begin{tabular}[t]{c}%
\@author
\end{tabular}\par}%
\vskip 1em%
{\large \@date}%
\end{center}%
\par
\vskip 1.5em
}
\makeatother

\begin{document}
\maketitle
Text goes here\footnote{A footnote} and\footnote{Another footnote}
\lipsum[2]

\newpage

Text goes here\footnote{A footnote} and\footnote{Another footnote}
\lipsum[2]

\end{document}

введите описание изображения здесь


Если используется устаревшая версия LaTeX, рассмотрите возможность загрузки пакетаeso-pic:

В приведенном ниже коде показан пример, в котором команда\AddToShipOutPicture пакетаeso-picобъединен с графической средой, в которой команда \putможет использоваться для позиционирования текста.

\documentclass[twoside]{article}
\usepackage{lipsum,eso-pic}
\title{A sample title}
\author{John Doe}

\makeatletter
\newcommand\ConvertToUnitlength[1]{%
  \strip@pt\dimexpr#1*65536/\number\dimexpr\unitlength\relax\relax
}%
\def\@maketitle{%
\newpage
\null
\vskip 2em%
\begin{center}%
\let \footnote \thanks
{\LARGE \@title \par}%
\vskip 1.5em%
{\large
\lineskip .5em%
\begin{tabular}[t]{c}%
\@author
\end{tabular}\par}%
\vskip 1em%
{\large \@date}%
\end{center}%
% If you want this on every page, use \AddToShipoutPicture.
% If you want this on the title-page only, use \AddToShipoutPicture*.
\AddToShipoutPicture{%
  \vbox to \paperheight{%
    \hsize=\paperwidth
    %----------------------------------------------------
    %       Within the \vbox do whatever you like:
    %       e.g., use a picture-environment:
    %----------------------------------------------------
    \setlength{\unitlength}{1cm}%
    \begin{picture}(\ConvertToUnitlength{\paperwidth},
                    \ConvertToUnitlength{\paperheight})(0,0)%
      % Inside this picture 0,0 is the bottom left corner.
      % Unit is cm.
      % If you wish to use length-parameter or \dimexppr, you can use \ConvertToUnitlength.
      % With recent LaTeX \ConvertToUnitlength is not really needed, but
      % you can use it for hiding ( and ) belonging to a \dimexpr
      % from the scanning for a )-delimiter of a \put-command.
      % You can also use eso-pic's \LenToUnit for this purpose.
      % If you need to learn about length-parameters of page-layout, see the documentation of the package "layout".
      \put(\ConvertToUnitlength{\dimexpr 1in+\ifodd\thepage\oddsidemargin\else\evensidemargin\fi\relax},
           \ConvertToUnitlength{.5\dimexpr\paperheight-(1in+\topmargin+\headheight+\headsep+\textheight+\footskip)+\ht\strutbox\relax})%
      {%
        \hbox to\textwidth{\copyright\ 2022 John Doe \hfill Department of Mathematics}%
      }%
    \end{picture}%
    %----------------------------------------------------
  }%
}%
\par
\vskip 1.5em
}
\makeatother

\begin{document}
\maketitle
Text goes here\footnote{A footnote} and\footnote{Another footnote}
\lipsum[2]

\newpage

Text goes here\footnote{A footnote} and\footnote{Another footnote}
\lipsum[2]

\end{document}

введите описание изображения здесь

решение2

В качестве альтернативы, если вам нравятся грубые хаки, и если текст должен появляться только на титульном листе, а титульный лист в любом случае содержит сноски, так что черта, отделяющая основной текст от сносок, нарисована, и вы заканчиваете титульный лист с помощью \newpage, вы можете использовать \footnotetextright before \newpageдля размещения последней «сноски», содержащей ваше уведомление об авторских правах. Если используется hyperref, все нужно обернуть в -environment NoHyper. Я не знаю, как это взаимодействует с \raggedbottom/ \flushbottom.

\documentclass[twoside]{article}
\usepackage{lipsum,hyperref}
\title{A sample title}
\author{John Doe}

\makeatletter
\def\@maketitle{%
\newpage
\null
\vskip 2em%
\begin{center}%
\let \footnote \thanks
{\LARGE \@title \par}%
\vskip 1.5em%
{\large
\lineskip .5em%
\begin{tabular}[t]{c}%
\@author
\end{tabular}\par}%
\vskip 1em%
{\large \@date}%
\end{center}%
% If you want this on every page, use \AddToShipoutPicture.
% If you want this on the title-page only, use \AddToShipoutPicture*.
\par
\vskip 1.5em
}
\makeatother

\begin{document}
\maketitle
Text goes here\footnote{A footnote} and\footnote{Another footnote}
\lipsum[2]

\begingroup
\makeatletter
\long\def\@makefntext#1{\noindent#1}%
\begin{NoHyper}%
\footnotetext{\par\vspace*{\dimexpr\footskip-2\baselineskip\relax}{\normalsize\copyright\ 2022 John Doe \hfill Department of Mathematics}}%
\end{NoHyper}%
\endgroup
\newpage

Text goes here\footnote{A footnote} and\footnote{Another footnote}
\lipsum[2]

\end{document}

введите описание изображения здесь

Связанный контент