l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
September 2: Social gathering
Next Installfest:
TBD
Latest News:
Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk
Page last updated:
2006 Dec 14 15:48

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] Fwd: LATEX, ucthesis.cls and changes in font size
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] Fwd: LATEX, ucthesis.cls and changes in font size



Apologies if Pete already posted this.  Obviously checking up with a week
or so of limited online access.  Didn't want to delete it in case Pete
didn't get it posted to vox-tech already, though...

-bill!
(sleep depriv0ed!)

----- Forwarded message from vox-tech-bounces@lists.lugod.org -----

Date: Wed, 6 Dec 2006 08:08:19 -0800
From: Peter Salzman <p@cbreak.com>
Subject: Re: [vox-tech] LATEX, ucthesis.cls and changes in font size
To: vox-tech@lists.lugod.org

On Tue 05 Dec 06,  7:44 PM, Dylan Beaudette <dylan.beaudette@gmail.com> said:
> Greetings,
> 
> I am attempting to use the ucthesis.cls document class for my MS thesis, but 
> have run into a bit of a snag in terms of altering font size. Commands like 
> \tiny \scriptsize etc. do not seem to have any effect within a verbatim 
> environment. I did not have this problem when using a different document 
> class. Ideally I would like all verbatim blocks to be slightly smaller than 
> the rest of the text so that they don't take up as much room on the page.
> 
> here is a link to some of the details:
> http://www.movesinstitute.org/~kolsch/ucthesis/ucthesis.readme
> 
> Cheers,




Hey Dylan,

Do yourself a favor and don't ever use verbatim.  There's another package
which is at least an order of magnitude better.  Maybe even two orders of
magnitude.  It's called fancyvrb.


You can change font size quite easily with it:


   \usepackage{fancyvrb}

   \begin{Verbatim}[fontsize=8]
      foobar
   \end{Verbatim}


The fancyvrb environment rocks supremely when you include another package
called 'relsize' because it allows you to change fontsize relative to the
current fontsize:


   \usepackage{fancyvrb,relsize}

   \begin{Verbatim}[fontsize=\relsize{-2}]
      foobar
   \end{Verbatim}


It also allows you to print line numbers next to the text on the left margin
(note you can also use "numbers=right" to get the numbers to the right of
the text).


   \begin{Verbatim}[fontsize=\relsize{-2},numbers=left]
      item 1
      item 2
      item 3
   \end{Verbatim}


You can even define your own environment so you don't have to keep putting
the same options within the [] everytime you use fancyvrb:


   \DefineVerbatimEnvironment%
      {VerbatimProg}%
      {Verbatim}%
      {numbers=left, fontsize=\relsize{-2}, frame=single}


   \begin{VerbatimProg}
   int main( int argc, char *argv[] );
   \end{VerbatimProg}


BTW, the "frame=single" means "put a frame box around the verbatim text".
Another very cool feature.

One really great thing about fancyvrb is that you __can__ use LaTeX commands
from within the verbatim environment.  OH YESSSSSSSS!!!!!!

   \DefineVerbatimEnvironment%
      {VerbatimCmdProg}%
      {Verbatim}%
      {numbers=left, fontsize=\relsize{-2}, frame=single, commandchars=\\\{\}}


Allows you to do...



   \begin{VerbatimCmdProg}
   int main( void )
   \{
         printf("hello world\Backslash{n}");   \label{printf_call}
         return 0;
   \}
   \end{VerbatimCmdProg}


   Here we call {\tt printf()} at line \ref{printf_call}.


Two things to note when you use the commandchars feature of fancyvrb:

   * You have to escape the French braces "{" and "}".
   * You also have to jump through a hoop to print backslashes.  Here's how
      I defined \Backslash:

         \newcommand{\Backslash}[1]{\texttt{\symbol{92}}#1}


This is just a very tiny example of the power of fancyvrb.

Have fun!

Peter


----- End forwarded message -----

-- 
-bill!
bill@newbreedsoftware.com
http://www.newbreedsoftware.com/
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.