Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to reduce the size of horizontal line.

\begin{frame}
\restylealgo{boxed}
\begin{algorithm}[H]
\Setline
\nl i\;
\end{algorithm}
\end{frame}
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Place the contents of your algorithm inside a minipage of the appropriate width. Here's an example highlighting this:

enter image description here

\documentclass{beamer}% http://ctan.org/pkg/beamer
\usepackage{algorithm2e}% http://ctan.org/pkg/algorithm2e
\begin{document}
\begin{frame}
  \RestyleAlgo{boxed}
  \begin{algorithm}[H]
    \SetAlgoLined
    \nl i\;
  \end{algorithm}

  \bigskip

  \begin{minipage}{.5\linewidth}
  \begin{algorithm}[H]
    \SetAlgoLined
    \nl i\;
  \end{algorithm}
  \end{minipage}
\end{frame}
\end{document}

Also, you should update your version of algorithm2e. Since version 4.0, some commands have been modified - I'm using them above.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.