# How to apply adjustbox on an algorithm(2e)

I have a double page document and I wish to add an algorithm at a certain point. But if I just include the algorithm (of the algorithm2e package) then the text gets really bad since many lines of the algorithm break the column.

So I have my algorithm some thing like

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts

\usepackage{lipsum}

\newsavebox{\tempbox}
\let\oldnl\nl% Store \nl in \oldnl
\begin{document}

\title{For the Horde!}

\author
{
\IEEEauthorblockN{  Broxigar the Ax \IEEEauthorrefmark{2}}
{
\begin{tabular}{cc}
\begin{tabular}{@{}c@{}}
\IEEEauthorrefmark{2}
Orgrimmar, Azeroth
\end{tabular}
\end{tabular}
}
}
\maketitle

\begin{abstract}
\lipsum[1]
\end{abstract}

\section{Erroneous Algorithm}

\begin{algorithm}[tbh]
\SetAlgoLined
\SetKwFunction{INT}{Intersection}
\SetKwFunction{UN}{Union}
\SetKwFunction{MAX}{Maximize}

\SetKwInOut{Input}{input}
\SetKwInOut{Output}{output}

\Input{Tree integer numbers, one prime number and one banana}
\Output{The circumference of our planet}

\BlankLine

\For{$i \leftarrow 0$ \KwTo $100,000,000$}
{
\tcp*[h]{Maximize the minimized value twice}
\MAX{this\_is\_going\_to\_break\_the\_column\_width\_for\_sure,tw}\;
}
\end{algorithm}

\end{document}


And I want to 'wrap' that with an adjustbox in order to make it fit. Like

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts

\usepackage{lipsum}

\newsavebox{\tempbox}
\let\oldnl\nl% Store \nl in \oldnl
\begin{document}

\title{For the Horde!}

\author
{
\IEEEauthorblockN{  Broxigar the Ax \IEEEauthorrefmark{2}}
{
\begin{tabular}{cc}
\begin{tabular}{@{}c@{}}
\IEEEauthorrefmark{2}
Orgrimmar, Azeroth
\end{tabular}
\end{tabular}
}
}
\maketitle

\begin{abstract}
\lipsum[1]
\end{abstract}

\section{Erroneous Algorithm}

\begin{algorithm}[tbh]
\SetAlgoLined
\SetKwFunction{INT}{Intersection}
\SetKwFunction{UN}{Union}
\SetKwFunction{MAX}{Maximize}

\SetKwInOut{Input}{input}
\SetKwInOut{Output}{output}

\Input{Tree integer numbers, one prime number and one banana}
\Output{The circumference of our planet}

\BlankLine

\For{$i \leftarrow 0$ \KwTo $100,000,000$}
{
\tcp*[h]{Maximize the minimized value twice}
\MAX{this\_is\_going\_to\_break\_the\_column\_width\_for\_sure,tw}\;
}
\end{algorithm}

\end{document}

• @Broxigar: Note that width-\textwidth is not correct; you're probably interested in width=\textwidth. – Werner Nov 23 '20 at 18:33
• Please prepare a complete minimal working example (MWE) starting with \documentclass and ending with \end{document} that shows what exactly you do. By default, overly wide lines in an algorithm2e algorithm environment should be broken into multiple lines avoiding an overlap with the adjacent column's text. If that's not the case in your document, this must be caused by something you did not show yet. – leandriis Nov 23 '20 at 18:33