# How do I reproduce this in latex?

This is what I'm trying to produce:

This is what I have so far:

\documentclass[varwidth,12pt,preview,margin=3mm]{standalone}

\usepackage{newtxtext}
\usepackage{newtxmath}
\usepackage{color}
\pagecolor{yellow}

\begin{document}

\begin{center}
Animation Test
\vspace{6pt}

\textbf{\huge 1}
\end{center}

\end{document}


I can't get the background colour to work, but it otherwise looks more or less as it should. I've tried other document classes but they all have their own problems, such as adding in a ton of extra features I don't want, or else other parts of the code don't work instead.

Could someone help me get it working?

• I am not sure why it doesn't work with standalone class, however, it does run okay with article class (of course, without adding any extra packages). May be something for you to check at: tex.stackexchange.com/questions/25137/…; tex.stackexchange.com/questions/82498/… – Raaja Nov 5 '18 at 8:13
• try removing the preview mode :) as if in \documentclass[varwidth,12pt,margin=3mm]{standalone}. May be that could help. – Raaja Nov 5 '18 at 8:17
• Thanks @Raaja. Removing preview worked. The documentation for standalone seemed to suggest I needed that to get the margins working correctly, but apparently not. Seems to be all fine now. :) – Ulysses Nov 5 '18 at 8:25
• It's either preview or varwidth to get paragraph mode for the content. Using both might not do what you want. – Martin Scharrer Dec 21 '18 at 9:09
• @Raaja: Please post your comment as an answer then, so the OP can accept it. This concludes the question officially and removes it from the "unanswered list". – Martin Scharrer Dec 26 '18 at 17:53

Removing the preview mode as in  \documentclass[varwidth,12pt,margin=3mm]{standalone} should do the job. Whence, you could use this:

\documentclass[varwidth,12pt,margin=3mm]{standalone}

\usepackage{newtxtext}
\usepackage{newtxmath}
\usepackage{color}
\pagecolor{yellow}

\begin{document}

\begin{center}
Animation Test
\vspace{6pt}

\textbf{\huge 1}
\end{center}

\end{document}


You can do this very easily using standalone and adjustbox. Use the stack key to stack the text and number, the margin key for the margin and the bgcolor key for the background color. The \struts are for the correct lineskip.

\documentclass[12pt]{standalone}

\usepackage{newtxtext}
\usepackage{newtxmath}
\usepackage{xcolor}

\begin{document}
Animation Test\strut\\[6pt]
\huge\bfseries 1\strut}%
\end{document}


With this solution you could also add an animation with different background colors:

\documentclass[12pt,multi=PAGE]{standalone}

\usepackage{newtxtext}
\usepackage{newtxmath}
\usepackage{xcolor}