Text FormattingTextbox Query

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
anirban
Posts: 2
Joined: Sat Jun 19, 2010 5:08 pm

Textbox Query

Post by anirban »

I want to put the following inside textbox.

Code: Select all

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: Select all

\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: Select all

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

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Textbox Query

Post by localghost »

I think even for this simple example the listings package is a good solution because of its flexibility in customization.


Best regards and welcome to the board
Thorsten
anirban
Posts: 2
Joined: Sat Jun 19, 2010 5:08 pm

Re: Textbox Query

Post by anirban »

Okay thanks a lot!
But sorry to say that I could not find the style I needed as I have pointed to the PDF in the link I have provided.

Any further help please!
Post Reply