# LateX Help

This is a discussion on LateX Help within the Tech Board forums, part of the Community Boards category; I want to put one small C-code in a textbox. How shall I do it?...

1. ## LateX Help

I want to put one small C-code in a textbox.
How shall I do it?

2. Thanks but I could not make it work!

I want to put the following inside textbox.

Code:
FindMincut(undirected graph G)
{
while there are more than 2 nodes in G do
{
pick an edge (u,v) at random in G;
contract the edge, while preserving multi-edges;
remove all loops;
}
output the remaining edges;
}
I tried the following...

Code:
\begin{framed}

\begin{verbatim}
FindMincut(undirected graph G)
{
while there are more than 2 nodes in G do
{
pick an edge (u,v) at random in G;
contract the edge, while preserving multi-edges;
remove all loops;
}
output the remaining edges;
}
\end{verbatim}

\end{framed}
I am getting a page wide huge box around the text.
Can I make it smaller and more descent looking?
I want the boxes like this given in the PAGE-4 of the following PDF.

Code:
http://www.cs.dartmouth.edu/~ac/Teach/CS105-Winter05/Handouts/05-mincut.pdf

3. Ok i have to admit it wasnt as easy as i thought, but after much googling i found it out:

Code:
\documentclass[11pt,a4paper]{report}

\usepackage[pdftex]{graphicx}
\usepackage{fancyvrb}

\begin{document}

\begin{SaveVerbatim}{Code}
FindMincut(undirected graph G)
{
while there are more than 2 nodes in G do
{
pick an edge (u,v) at random in G;
contract the edge, while preserving multi-edges;
remove all loops;
}
output the remaining edges;
}
\end{SaveVerbatim}

\fbox
{
\begin{minipage}[t]{\textwidth}
\BUseVerbatim{Code}
\end{minipage}
}

\end{document}

4. Thanks for the help
But it is not showing as I wanted in the PDF as shown above in the link!

Popular pages Recent additions