0

Right now, I have this code:

\documentclass{book}

\renewcommand\sfdefault{cmss}
\renewcommand{\familydefault}{\sfdefault}

\usepackage[top = 2.54cm, bottom = 2.54cm, left = 1.5cm, right = 1.5cm]{geometry}   % en mecanica dejarlo en 2.54x2 y 2.1x2

\usepackage{fancyhdr}  
    \pagestyle{fancy}
    \fancyhf{}


    \renewcommand{\headrulewidth}{0.5pt}
    %\renewcommand{\footrulewidth}{0.5pt}

    \fancypagestyle{plain}{%
        \fancyhf{}
        \fancyhead[R]{\thepage}
        \renewcommand{\headrulewidth}{0pt}
        \renewcommand{\footrulewidth}{0pt}
    }


\usepackage{mathtools}


\begin{document}

\begin{titlepage}
    \begin{center}
        {\scshape\large Some text book} 
        \\ \vspace{0.2cm}
        %

        {\scshape\Huge Algebra and Calculus} \\
        {\small\hspace{11.5cm} $^{\displaystyle\text{\textit{by} Peluche!}}$}

    \end{center}
    This is just some text without indent to let you see the width of the page.
\end{titlepage}
\end{document}

that produces

enter image description here

where Algebra and Calculus is the title and by Peluche! the author of the document. This is a code I wrote a long time ago. To every "text book" I have to change the \hspace to make it aligned with the title of the "text book". But now, I'd like to align it automatically for every "text book". To try to do this, I wrote the following code:

\documentclass{book}

\renewcommand\sfdefault{cmss}
\renewcommand{\familydefault}{\sfdefault}

\usepackage[top = 2.54cm, bottom = 2.54cm, left = 1.5cm, right = 1.5cm]{geometry}   % en mecanica dejarlo en 2.54x2 y 2.1x2

\usepackage{fancyhdr}  
    \pagestyle{fancy}
    \fancyhf{}


    \renewcommand{\headrulewidth}{0.5pt}
    %\renewcommand{\footrulewidth}{0.5pt}


    \fancypagestyle{plain}{%
        \fancyhf{}
        \fancyhead[R]{\thepage}
        \renewcommand{\headrulewidth}{0pt}
        \renewcommand{\footrulewidth}{0pt}
    }


\usepackage{mathtools}


\begin{document}

\begin{titlepage}
    \begin{center}
        {\scshape\large Some text book} 
        \\ \vspace{0.2cm}
        %
        {\scshape\Huge $\text{Algebra and Calculus}_{\text{\normalfont\small \textit{by} Peluche!}}$}

    \end{center}
    This is just some text without indent to let you see the width of the page.
\end{titlepage}
\end{document}

that produces

enter image description here

The problem here is the not-alignment of the title to the center of the page because of the subscript "by Peluche!".

The question is how to center the title and how to positionate/align (automatically) the author's name at/with the end of the title. In others words, how to choose the argument of the \hspace in the first code automatically. Thanks for reading!

2 Answers 2

2
  • Your question isn't entirely clear, what you after.
  • Don't write title in math environment.
  • Does author should be written as title subscript or as it is usulat at books centered below of the book title?
  • In the first case you can center title by writing subscript by use of the rlap macro:

enter image description here

\documentclass{book}
\usepackage{lipsum}

\renewcommand\sfdefault{cmss}
\renewcommand{\familydefault}{\sfdefault}

\usepackage[vmargin = 2.54cm, hmargin = 1.5cm]{geometry}   % en mecanica dejarlo en 2.54x2 y 2.1x2+
\usepackage{fancyhdr}
    \pagestyle{fancy}
    \fancyhf{}
    \renewcommand{\headrulewidth}{0.5pt}

    \fancypagestyle{plain}{%
        \fancyhf{}
        \fancyhead[R]{\thepage}
        \renewcommand{\headrulewidth}{0pt}
        \renewcommand{\footrulewidth}{0pt}
    }

\begin{document}

\begin{titlepage}
    \begin{center}
\scshape\large Some text book\

\medskip
        %
\scshape\Huge Algebra and Calculus\rlap{\textsubscript{\small\textit{by Peluche!}}}

    \end{center}
\lipsum[66]
\end{titlepage}

\end{document}
1

No need with \text in math mode, \textsubscript is okay. And you can use \phantom to fill the left of title.

\documentclass{book}
\usepackage[top=2.54cm,bottom=2.54cm,left=1.5cm,right=1.5cm]{geometry}
\begin{document}
\newcommand{\xxxx}{\normalfont\small\textit{by} Peluche!}
\begin{titlepage}
\begin{center}
{\scshape\large Some text book}
\\\vspace{0.2cm}
{\textsubscript{\phantom{\xxxx}}{\scshape\Huge Algebra and Calculus}\textsubscript{\xxxx}}
\end{center}
This is just some text without indent to let you see the width of the page.
\end{titlepage}
\end{document}

enter image description here

You must log in to answer this question.

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