How to change font size on part of the page in LaTeX?

前端 未结 5 534
庸人自扰
庸人自扰 2020-12-22 23:09

I\'d like to change text size for some page part, e.g. for verbatim block:

\\begin{verbatim}
   
\\end{verbatim         


        
相关标签:
5条回答
  • 2020-12-22 23:49

    Example:

    \Large\begin{verbatim}
       <how to set font size here to 10 px ? />
    \end{verbatim}
    \normalsize
    

    \Large can be obviously substituted by one of:

    \tiny
    \scriptsize
    \footnotesize
    \small
    \normalsize
    \large
    \Large
    \LARGE
    \huge
    \Huge
    

    If you need arbitrary font sizes:

    • How can I get an arbitrary font size in LaTeX?
    0 讨论(0)
  • 2020-12-22 23:53

    http://en.wikibooks.org/wiki/LaTeX/Formatting

    use \alltt environment instead. Then set size using the same commands as outside verbatim environment.

    0 讨论(0)
  • 2020-12-22 23:54

    To add exact fontsize you can use following. Worked for me since in my case predefined ranges (Large, tiny) are not match with the font size required to me.

    \fontsize{10}{12}\selectfont This is the text you need to be in 10px
    

    More info: https://tug.org/TUGboat/tb33-3/tb105thurnherr.pdf

    0 讨论(0)
  • 2020-12-23 00:06
    \begingroup
        \fontsize{10pt}{12pt}\selectfont
        \begin{verbatim}  
            % how to set font size here to 10 px ?  
        \end{verbatim}  
    \endgroup
    
    0 讨论(0)
  • 2020-12-23 00:15

    The use of the package \usepackage{fancyvrb} allows the definition of the fontsize argument inside Verbatim:

    \begin{Verbatim}[fontsize=\small]
    print "Hello, World"
    \end{Verbatim}
    

    The fontsize that you can specify are the common

    \tiny 
    \scriptsize  
    \footnotesize 
    \small
    \normalsize
    \large
    \Large
    \LARGE
    \huge
    \Huge
    
    0 讨论(0)
提交回复
热议问题