I have this code:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[portuguese, ruled, linesnumbered, boxruled]{algorithm2e}
\begin{document}
\begin{algorithm}[H]
\SetAlgoLined
\Entrada{Parâmetros}
\Saida{$P_t$}
\Inicio{
$t \leftarrow$ GeraNovaPopulação(); \\
Avalia($P_t$); \\
\Enqto{\textbf{\textit{não}} CriterioParadaAtingido()}{
$Q_t \leftarrow$ Variação($P_t$); \\
Avalia($Q_t$); \\
$P_{t + 1} \leftarrow$ Atualiza($Q_t$, $P_t$); \\
$t \leftarrow t + 1$; \\
}
}
\caption{Pseudocódigo de uma MOEA.\label{algo:moea-pseudocode}}
\end{algorithm}}
\end{document}
And it produces the following output:
What I want to know if it is possible to decrease the width of the horizontal line, i.e, shrink it to the maximum.
EDIT:
The desired output, as posted in the comments by @Werner and mentioned by @marmot is:
algorithm
into\begin{minipage}{9cm}
and\end{minipage}
. As for the general case, I have no clue. (One could probably use thetikzmark
library to measure the length of the lines, but this will lead to a very convoluted proposal, at least when I try to spell it out.)