1

Consider the code

\documentclass[12pt]{book}
\usepackage{scalefnt}
\usepackage[sfdefault]{cabin}
\usepackage{mathptmx} % replaces obsolete times package.

\newcommand{\longemdash}{{\fontfamily{cmss}\selectfont---}}
\newcommand{\fancyquote}[2]{%
  \par\scalefont{1.05}{#1}\\[2pt]\hspace*{\fill}\longemdash{\fontfamily{qtm}\selectfont\textit{\textbf{#2}}}%
}
\begin{document}
\thispagestyle{empty}
\begin{enumerate}
\item \fancyquote{Even if you're on the right track, you'll get run over if you just sit there.}{Will Rogers}

%\item \fancyquote{}{}
%\item \fancyquote{}{}
%\item \fancyquote{}{}
\end{enumerate}
\end{document}

which produces

enter image description here

Now, I would like to facilitate the typing of many such quotes in this enumerate environment by replacing \item by \item \fancyquote{}{}. However, uncommenting the command %\item \fancyquote{}{} produces an error upon compilation with pdflatex.

In actuality, I anticipate having to enter over one hundred such quotes; it would be helpful if I could pre-structure the environment with something like \item \fancyquote{}{} instead of \item.

QUESTION: Is there a way I can do something like this without producing an error. I am hoping not to resort, say, to something like \item \fancyquote{A}{B}, which would compile without error, but would necessitate the deletion of the A and the B each time I enter a new quote---which, as I said, I anticipate to be over one hundred in number.

Thank you.

1 Answer 1

2

something like this, I assume you mean

enter image description here

\documentclass[12pt]{book}
\usepackage{scalefnt}
\usepackage[sfdefault]{cabin}
\usepackage{mathptmx} % replaces obsolete times package. %but is almost as old and obsolete

\newcommand{\longemdash}{{\fontfamily{cmss}\selectfont---}}
\newcommand{\fancyquote}[2]{%
  \par\scalefont{1.05}{\leavevmode\ignorespaces#1}\\[2pt]%
  \hspace*{\fill}\longemdash{\fontfamily{qtm}\selectfont\textit{\textbf{#2}}}%
}
\begin{document}
\thispagestyle{empty}
\begin{enumerate}
\item \fancyquote{Even if you're on the right track, you'll get run over if you just sit there.}{Will Rogers}

\item \fancyquote{}{}
\item \fancyquote{}{}
\item \fancyquote{}{}
\end{enumerate}
\end{document}
1
  • Many thanks David Carlisle. That is indeed what I am looking for.
    – DDS
    Feb 21, 2023 at 0:28

You must log in to answer this question.

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