# Adjustbox ate my newlines

Apologies for the long MWE. Wanted to understand what I was doing wrong here. Trying to shrink this as part of a longer exercise in producing some slides. (This is the legend for a graphic referenced elsewhere on the site). Why is adjustbox doing this? How can I stop it.

\documentclass[10pt,landscape]{article}
%\usepackage{preamble}
\usepackage[left=0.5in,right=1in,top=2in,bottom=1.5in]{geometry}
\usepackage{tikz}
\usepackage{textpos}
\usepackage{adjustbox}
\usepackage{marvosym}
\usepackage{anyfontsize}
\usepackage{xcolor}
\PassOptionsToPackage{table}{xcolor}
\PassOptionsToPackage{kernelfbox}{xcolor}

\usetikzlibrary{positioning,shapes.geometric,shapes,arrows,chains,mindmap,trees,backgrounds}
\setlength{\TPHorizModule}{1in}\setlength{\TPVertModule}{1in}

\definecolor{ablue1}{RGB}{0,79,182}
\definecolor{agrey1}{RGB}{164,174,181}
\definecolor{ablue2}{RGB}{0,169,224}
\definecolor{agrey2}{RGB}{81,98,111}
\definecolor{ablue3}{RGB}{114,199,231}
\definecolor{agreen1}{RGB}{89,179,55}
\definecolor{ayellow1}{RGB}{255,184,28}
\definecolor{agreen2}{RGB}{39,89,55}
\definecolor{ablue4}{RGB}{194,222,234}
\definecolor{agreen3}{RGB}{0,121,52}
\definecolor{agreen4}{RGB}{169,220,146}
\definecolor{aorange}{RGB}{229,114,0}
\definecolor{ayellow2}{RGB}{248,234,142}

\def\Mgt{\textcolor{agrey2}{\Gentsroom}}
\def\Inveq{\textcolor{ayellow1}{\Gentsroom}}
\def\Invfi{\textcolor{ayellow2}{\Gentsroom}}
\def\Rel{\textcolor{agreen1}{\Gentsroom}}
\def\Rem{\textcolor{ablue2}{\Gentsroom}}
\def\Adm{\textcolor{aorange}{\Gentsroom}}
\def\Rsk{\textcolor{agrey1}{\Gentsroom}}
\def\Bzd{\textcolor{ablue4}{\Gentsroom}}
\def\Sup{\textcolor{agreen3}{\Gentsroom}}

\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

\begin{document}

\begin{textblock}{2}[0,0](0,-2)
\begin{minipage}[r][0.5\textheight][b]{0.25\paperwidth}
\adjustbox{scale={0.75}}{
{\Mgt} {\scriptsize Msldfk} \par
{\Bzd} {\scriptsize Bsadlfsj} \newline
{\Rsk} {\scriptsize Rwelj} \tabularnewline
{\Rem} {\scriptsize Rweld} \\
{\Adm} {\scriptsize Afddsf} \\
{\Rel} {\scriptsize Refsdfd} \\
{\Invfi} {\scriptsize Fikjlkjklj} \\
{\Inveq} {\scriptsize Ejknsdfd}\\
{\Sup} {\scriptsize Support}\\
}
\end{minipage}
\end{textblock}

\end{document}

-
The \adjustbox and the basically identical adjustbox environment enfore the so called restricted horizontal mode for the content. In this mode you can't have line breaks. You need to wrap the content into a paragraph building element, like \parbox, minipage or varwidth. The last two are also provided as options to \adjustbox and {adjustbox}. See the manual for more details. – Martin Scharrer Dec 1 '12 at 16:15

## 1 Answer

I cannot answer why it ignores newline commands (there must be a good reason!) but I can tell you how to avoid it.

Give adjustbox the minipage option. EDIT and in this case you can omit the outer minipage you used, and give all the options to adjustbox option. In your example:

\begin{textblock}{2}[0,0](0,-2)
\noindent\adjustbox{minipage=[r][0.5\textheight][b]{0.25\paperwidth},scale={0.75}}{
{\Mgt} {\scriptsize Msldfk} \\
{\Bzd} {\scriptsize Bsadlfsj} \\
{\Rsk} {\scriptsize Rwelj} \\
{\Rem} {\scriptsize Rweld} \\
{\Adm} {\scriptsize Afddsf} \\
{\Rel} {\scriptsize Refsdfd} \\
{\Invfi} {\scriptsize Fikjlkjklj} \\
{\Inveq} {\scriptsize Ejknsdfd}\\
{\Sup} {\scriptsize Support}
}
\end{textblock}


-
presumably adjustbox defaults to being a horizontal (LR) box like mbox or fbox, which would similarly be single line. – David Carlisle Nov 30 '12 at 11:24
@JLDiaz that was worth it just for the time it will save me typing the minipage thing in over and over again.. Thank you. – Tahnoon Pasha Nov 30 '12 at 11:38
@DavidCarlisle: Indeed, it uses restricted horizontal mode and therefore no line breaks work. You need to use the minipage option as shown here or the similar, but easier varwidth=<max width> option. – Martin Scharrer Dec 1 '12 at 16:12