5

I am using the fancyvrb package. Even though I set the font size to \tiny, it still doesn't properly fit in a single slide. I was wondering is there a way to scale it down even further. Thank you

\documentclass{beamer}
\usepackage{graphicx}

\usetheme{default}

\usepackage{float}
\usepackage{tikz}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{bibentry}
\usepackage{setspace}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{xcolor}
\usepackage{mathrsfs}
\usepackage{soul}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{spverbatim}
\usepackage{multicol}
\usepackage{fancyvrb}
\usepackage[super]{nth}
\usepackage{listings}
\usepackage{linegoal}
\usepackage{calc}
\usepackage{tikz-qtree}
\usepackage{forest}

\begin{document}

\begin{frame}[fragile=singleslide]{Example}{Classical attribute grammar to find semantic errors in a program}

\scalebox{.9}{
\begin{multicols}{2}
\begin{Verbatim}[fontsize=\tiny]
program -> block
    block.env = empty_env()
    program.msgs = block.msgs
    
block -> "begin" decls stmts "end"
    decls.envin = block.env
    stmts.env = decls.envout
    decls.uin = stmts.used
    block.used = decls.uout
    block.msgs = decls.msgs ++ stmts.msgs
    
decls ->
    decls.envout = decls.envin
    decls.uout = decls.uin
    decls.msgs = { }

decls -> decls decl
  decls1.envin = decls0.envin
  decl.envin = decls1.envout
  decls0.envout = decl.envout
  decl.uin = decls0.uin
  decls1.uin = decl.uout
  decls0.uout = decls1.uout
  decls0.msgs = decls1.msgs ++ decl.msgs

decl -> id ":" type ";"
  decl.envout = add_env(<id, type.shape>, decl.envin)
  decl.uout = decl.uin - id
  decl.msgs = if id in decl.uin then
                { }
              else
                { "unused: " + id }

type -> "integer"
  type.shape = INTSHAPE

type -> "string"
  type.shape = STRSHAPE

stmt ->
  stmts.used = { }
  stmts.msgs = { }

stmts -> stmts stmt
  stmts1.env = stmts0.env
  stmt.env = stmts0.env
  stmts0.used = stmts1.used ++ stmt.used
  stmts0.msgs = stmts1.msgs ++ stmt.msgs

stmt -> block ";"
  block.env = stmt.env
  stmt.used = block.used
  stmt.msgs = block.msgs

stmts -> expr ":=" expr ";"
  expr1.env = stmt.env
  expr2.env = stmt.env
  stmt.used = expr1.used ++ expr2.used
  stmt.msgs = (if expr1.shape != expr2.shape then
                { "type mismatch" }
              else
                { }) ++ expr.msgs

expr -> INT_CONSTANT
  expr.shape = INTSHAPE
  expr.used = { }
  expr.msgs = { }

expr -> strconstant
  expr.shape = STRSHAPE
  expr.used = { }
  expr.msgs = { }

expr -> id
  local shape = lookup(id, expr.env)
  expr.shape = shape
  expr.used = { id }
  expr.msgs = if shape == NOT_FOUND then
                { id + " not declared" }
              else
                { }
\end{Verbatim}
\end{multicols}}

\end{frame}

\end{document}

With scale box: enter image description here

Without scale box: enter image description here

4
  • 3
    reconsider the content of your slide. If the text doesn't fit in tiny, you have to much text. Depending on how you present it is perhaps even not readable at all. Dec 5, 2021 at 10:01
  • 2
    unrelated to beamer you can not have multicols in a scalebox Dec 5, 2021 at 12:36
  • 3
    Do you really expect anyone to be able to read \tiny text on a slide? Rethink how you are showing stuff to your audience (maybe two slides?) Dec 5, 2021 at 18:01
  • @PeterWilson Good point. Thank you
    – Node.JS
    Dec 5, 2021 at 18:06

1 Answer 1

8

This way? See: How to get an even smaller font size than \tiny?.

\documentclass{beamer}
\usepackage{graphicx}

\usetheme{default}

\usepackage{float}
\usepackage{tikz}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{bibentry}
\usepackage{setspace}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{xcolor}
\usepackage{mathrsfs}
\usepackage{soul}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{spverbatim}
\usepackage{multicol}
\usepackage{fancyvrb}
\usepackage[super]{nth}
\usepackage{listings}
\usepackage{linegoal}
\usepackage{calc}
\usepackage{tikz-qtree}
\usepackage{forest}

\begin{document}

\begin{frame}[fragile=singleslide]{Example}{Classical attribute grammar to find semantic errors in a program}

\begin{multicols}{2}
\begin{Verbatim}[fontsize=\fontsize{2.5}{4}\selectfont]
program -> block
    block.env = empty_env()
    program.msgs = block.msgs
    
block -> "begin" decls stmts "end"
    decls.envin = block.env
    stmts.env = decls.envout
    decls.uin = stmts.used
    block.used = decls.uout
    block.msgs = decls.msgs ++ stmts.msgs
    
decls ->
    decls.envout = decls.envin
    decls.uout = decls.uin
    decls.msgs = { }

decls -> decls decl
  decls1.envin = decls0.envin
  decl.envin = decls1.envout
  decls0.envout = decl.envout
  decl.uin = decls0.uin
  decls1.uin = decl.uout
  decls0.uout = decls1.uout
  decls0.msgs = decls1.msgs ++ decl.msgs

decl -> id ":" type ";"
  decl.envout = add_env(<id, type.shape>, decl.envin)
  decl.uout = decl.uin - id
  decl.msgs = if id in decl.uin then
                { }
              else
                { "unused: " + id }

type -> "integer"
  type.shape = INTSHAPE

type -> "string"
  type.shape = STRSHAPE

stmt ->
  stmts.used = { }
  stmts.msgs = { }

stmts -> stmts stmt
  stmts1.env = stmts0.env
  stmt.env = stmts0.env
  stmts0.used = stmts1.used ++ stmt.used
  stmts0.msgs = stmts1.msgs ++ stmt.msgs

stmt -> block ";"
  block.env = stmt.env
  stmt.used = block.used
  stmt.msgs = block.msgs

stmts -> expr ":=" expr ";"
  expr1.env = stmt.env
  expr2.env = stmt.env
  stmt.used = expr1.used ++ expr2.used
  stmt.msgs = (if expr1.shape != expr2.shape then
                { "type mismatch" }
              else
                { }) ++ expr.msgs

expr -> INT_CONSTANT
  expr.shape = INTSHAPE
  expr.used = { }
  expr.msgs = { }

expr -> strconstant
  expr.shape = STRSHAPE
  expr.used = { }
  expr.msgs = { }

expr -> id
  local shape = lookup(id, expr.env)
  expr.shape = shape
  expr.used = { id }
  expr.msgs = if shape == NOT_FOUND then
                { id + " not declared" }
              else
                { }
\end{Verbatim}
\end{multicols}

\end{frame}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .