我正在使用这个fancyvrb
包。即使我将字体大小设置为\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}
\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}
答案1
这边走?参见:如何获得比 \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}