[Tex/LaTex] \framebox and tabbing not working together

framedtabbing

I wanted to frame in a box a text which includes tabbing. Both \framebox and tabbing works fine separately but cannot make them work together.

\framebox{
\begin{tabbing} 
\textit{Input:} \hspace*{13mm} \= assd \\
\textit{Problem:} \> adas  \\
\end{tabbing}
}

Best Answer

You can box the tabbing before framing it; in the following example I show two possibilities; the firs one, using a \vbox and the second one using a varwidth environment from the varwidth package:

\documentclass{article}
\usepackage{varwidth}

\begin{document}

\framebox{%
\vbox{\begin{tabbing} 
\textit{Input:} \hspace*{13mm} \= assd \\
\textit{Problem:} \> adas
\end{tabbing}}%
}

\framebox{\begin{varwidth}{\linewidth}
\begin{tabbing} 
\textit{Input:} \hspace*{13mm} \= assd \\
\textit{Problem:} \> adas
\end{tabbing}
\end{varwidth}}

\end{document}

enter image description here

You seem to be typesetting algorithms; in this case, some dedicated packages such as algorithmicx or listings could be useful for you.