Graphics, Figures & TablesBoxed Algorithms: Parbox

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
sw3quant
Posts: 76
Joined: Tue Nov 02, 2010 11:40 pm

Boxed Algorithms: Parbox

Post by sw3quant »

I am trying to put some highly enumerated text inside a box.
I don't want to use the algorithms package this time.
As I am doing this inside beamer (a power point type package for latex) I need to shrink the size of everything in the box. For some reason the standard fontsize{12pt} and \small do not work.

Please can someone advise on how I can shrink all the text/ equations etc etc

I wonder if this is something to do with using parbox and perhaps I should be using something else? If so what?

Can you help?

Thank you!


%\fontsize{6pt}{8pt} %doesnt work
\fcolorbox{black}[HTML]{E9F0E9}{\parbox{\textwidth}{%
%\noindent \textbf{blah}
\begin{description}
\item [Input:] Inputs
\begin{enumerate}
\item blah
\item blah
\item blah
\item blah
\end{enumerate}
\item [Output:] blah
\begin{enumerate}
\item Return
\item Compute
\item Compute
\item blah
\item blah
\begin{enumerate}
\item
\item
\item
\end{enumerate}
\item Calculate
\begin{enumerate}
\item
\item
\item
\end{enumerate}
\end{enumerate}
\end{description}}}
%\vspace{1cm}
%\normalsize

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Boxed Algorithms: Parbox

Post by frabjous »

Please always post a complete minimal working example and not just a snippet. And when posting code, use a code box, as specified in the Board Rules.

Theoretically you should be able to do this:

Code: Select all

\setbeamerfont{enumerate item}{size*={6}{8}}
\setbeamerfont{enumerate body}{size*={6}{8}}
\setbeamerfont{enumerate subbody}{size*={6}{8}}
\setbeamerfont{enumerate subitem}{size*={6}{8}}
But for reasons I don't really understand, it isn't working quite right.

I guess an alternative would be to use a resizebox or scalebox from the graphicx package.

Code: Select all

\documentclass{beamer}

\begin{document}


\begin{frame}
\resizebox{!}{1.6in}{%
\fcolorbox{black}[HTML]{E9F0E9}{\parbox{1.2\textwidth}{%
\begin{description}
\item [Input:] Inputs
\begin{enumerate}
\item blaha
\item blah
\item blah
\item blah
\end{enumerate}
\item [Output:] blah
\begin{enumerate}
\item Return
\item Compute
\item Compute
\item blah
\item blah
\item blah
\item blah
\item blah
\item Calculate
\begin{enumerate}
\item blah1
\item blah2
\item blah3
\item blah4
\item blah5
\end{enumerate}
\end{enumerate}
\end{description}
}
}
}
\end{frame}
\end{document}

sw3quant
Posts: 76
Joined: Tue Nov 02, 2010 11:40 pm

Re: Boxed Algorithms: Parbox

Post by sw3quant »

Dear frabjous.

thank you very much for your reply. That works perfectly.

I have one more question on this topic: If in the below code you remove the word "Inputs", you see that "input" is placed onto the same line as the first number (1).

I would like "input" to be on a line by itself. Then a carriage return and then the enumeration to start.

I have tried to use "\\" and "\vspace*" etc but nothing seems to work. Can you advise?

many thanks!
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: Boxed Algorithms: Parbox

Post by frabjous »

I think it just needs to shift modes, which you could do just by replacing "Inputs" with \mbox{}. I don't know what the "right" or "proper" way of doing it is, however.
sw3quant
Posts: 76
Joined: Tue Nov 02, 2010 11:40 pm

Re: Boxed Algorithms: Parbox

Post by sw3quant »

brilliant. thank you!
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Boxed Algorithms: Parbox

Post by localghost »

sw3quant wrote:brilliant. […]
Then please be so kind and mark the topic (not the last post) accordingly as written in the Board Rules.


Thorsten
sw3quant
Posts: 76
Joined: Tue Nov 02, 2010 11:40 pm

Re: Boxed Algorithms: Parbox

Post by sw3quant »

good stuff!
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Boxed Algorithms: Parbox

Post by localghost »

sw3quant wrote:good stuff!
What's the point of that?
Post Reply