Você pode me dizer outra solução para colocar uma linha de texto na parte inferior de uma página?

Você pode me dizer outra solução para colocar uma linha de texto na parte inferior de uma página?

Estou escrevendo uma classe de documento na qual desejo colocar uma linha de texto na parte inferior da área de texto, após as notas de rodapé para que seu lugar fique sempre totalmente fixo. Uma solução para isso é a seguinte:

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

Mas, por alguns motivos, não quero usar um ambiente flutuante. Você pode me sugerir outra solução (de preferência sem carregar pacotes extras)?

Responder1

Existem possibilidades de fazer posicionamento absoluto de texto em uma página. Por exemplo, tikz fornece meios para fazer isso.


Se uma versão recente do LaTeX estiver em uso onde os shipout-hooks estiverem disponíveis, você poderá adicionar código ao hook shipout/foreground.

O gancho shipout/foregroundrefere-se a um ambiente de imagem com canto superior esquerdo (0,0) no canto superior esquerdo da página e comprimento unitário de 1 ponto.
(Para que coisas ocorram na página, os componentes y/segundo das coordenadas precisam ser negativos. Com uma versão recente do LaTeX em um pictureambiente, não é necessário se preocupar com a normalização \dimexpre os registros de comprimento, \unitlengthpois isso é feito automaticamente.)

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

insira a descrição da imagem aqui


Se uma versão LaTeX não tão recente estiver em uso, considere carregar o pacoteeso-pic:

O código abaixo fornece um exemplo onde o comando \AddToShipOutPicturedo pacoteeso-picé combinado com um ambiente de imagem onde o comando \putpode ser usado para posicionar texto.

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

insira a descrição da imagem aqui

Responder2

Alternativamente, se você gosta de hacks grosseiros e se o texto deve ocorrer apenas na página de título, e a página de título em qualquer caso contém notas de rodapé para que a regra que separa o texto principal das notas de rodapé seja desenhada, e você termine a página de título via \newpage, você pode usar \footnotetextlogo antes \newpagepara colocar uma última "nota de rodapé" contendo seu aviso de direitos autorais. Se o hyperref estiver em uso, as coisas precisam ser agrupadas em um NoHyperambiente. Não sei como isso interage com \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}

insira a descrição da imagem aqui

informação relacionada