enumitem:如何让 Beamer Slides 更加紧凑

enumitem:如何让 Beamer Slides 更加紧凑

下面是使用 beamer 创建幻灯片的 TeX 文件示例:

% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
\PassOptionsToPackage{dvipsnames,svgnames*,x11names*}{xcolor}
%
\documentclass[
  ignorenonframetext,
  aspectratio = 169]{beamer}
\usepackage{pgfpages}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{caption label separator}{: }
\setbeamercolor{caption name}{fg=normal text.fg}
\beamertemplatenavigationsymbolsempty
% Prevent slide breaks in the middle of a paragraph
\widowpenalties 1 10000
\raggedbottom
\setbeamertemplate{part page}{
  \centering
  \begin{beamercolorbox}[sep=16pt,center]{part title}
    \usebeamerfont{part title}\insertpart\par
  \end{beamercolorbox}
}
\setbeamertemplate{section page}{
  \centering
  \begin{beamercolorbox}[sep=12pt,center]{part title}
    \usebeamerfont{section title}\insertsection\par
  \end{beamercolorbox}
}
\setbeamertemplate{subsection page}{
  \centering
  \begin{beamercolorbox}[sep=8pt,center]{part title}
    \usebeamerfont{subsection title}\insertsubsection\par
  \end{beamercolorbox}
}
\AtBeginPart{
  \frame{\partpage}
}
\AtBeginSection{
  \ifbibliography
  \else
    \frame{\sectionpage}
  \fi
}
\AtBeginSubsection{
  \frame{\subsectionpage}
}
\usepackage{amsmath,amssymb}
\usepackage{lmodern}
\usepackage{iftex}
\ifPDFTeX
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math}
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\usetheme[]{Nord}
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
  pdftitle={How Does the Eye Work},
  pdfauthor={Amar Al-Zubaidi},
  colorlinks=true,
  linkcolor={NordRed},
  filecolor={Maroon},
  citecolor={Blue},
  urlcolor={NordBlue},
  pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs
\newif\ifbibliography
\usepackage{longtable,booktabs,array}
\usepackage{calc} % for calculating minipage widths
\usepackage{caption}
% Make caption package work with longtable
\makeatletter
\def\fnum@table{\tablename~\thetable}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{5}
\ifLuaTeX
  \usepackage{selnolig}  % disable illegal ligatures
\fi

\title{How Does the Eye Work}
\author{Amar Al-Zubaidi}
\date{\today}

\begin{document}
\frame{\titlepage}

\begin{frame}{The Process of Vision}
\protect\hypertarget{the-process-of-vision}{}
text

\begin{enumerate}
\tightlist
\item
  Light enters the eye through the cornea.

  \begin{enumerate}
  \tightlist
  \item
    When we look at an object, light that is reflected off of the object enters the eye through the cornea.
  \item
    The cornea bends the light before it passes through the aqueous humor.
  \end{enumerate}
\item
  The pupil adjusts in response to the light.
\item
  The lens focuses the light onto the retina.
\item
  The light is focused onto the retina.
\item
  The optic nerve transmits visual information to the brain.
\end{enumerate}
\end{frame}

\end{document}

我想做一点改变:

  1. 删除列表的左边距

    我通常可以使用以下代码删除列表的左边距:

    \usepackage{enumitem}
    \setlist{leftmargin = *}
    

    但是如果我使用 beamer 执行此操作,我会收到此错误:

    ! TeX capacity exceeded, sorry [grouping levels=255].
    \labelenumi ->{
                   \labelenumi }
    l.138 \end{frame}
    

我该如何做这个改变?

答案1

投影仪中列表的左边距由长度等控制\leftmargini\leftmarginii

\documentclass{beamer}

\settowidth{\leftmargini}{\usebeamertemplate{itemize item}}
\addtolength{\leftmargini}{\labelsep}

\addtolength{\leftmarginii}{-0.1cm}

\begin{document}

\begin{frame}
\frametitle{The Process of Vision}
text

\begin{enumerate}
\item
  Light enters the eye through the cornea.

  \begin{enumerate}
  \item
    When we look at an object, light that is reflected off of the object enters the eye through the cornea.
  \item
    The cornea bends the light before it passes through the aqueous humor.
  \end{enumerate}
\item
  The pupil adjusts in response to the light.
\item
  The lens focuses the light onto the retina.
\item
  The light is focused onto the retina.
\item
  The optic nerve transmits visual information to the brain.
\end{enumerate}
\end{frame}

\end{document}

在此处输入图片描述

相关内容