我知道我可以使用 来抑制缩进项目符号\item[]
,但尽管如此,项目符号占据的垂直空间仍然保持空白。我考虑使用自定义list
环境,但这既不能调整空间也不能调整字体大小。以下示例中的箭头标记了一些有问题的地方。
\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{itemize}
\item A sub-itemize
\begin{itemize}
\item an item with a bullet
\item[] items without a bullet waste space
\item[] \(\leftarrow\) here
\end{itemize}
\item A sub-list
\begin{list}{}{}
\item these items are too big
\item the sublist font should be smaller
\item[] \(\leftarrow\) still too much space
\end{list}
\end{itemize}
\end{frame}
\end{document}
我该如何弥补差距?或者,如何创建一个新的环境,其工作原理类似于itemize
但只增加缩进并减小字体大小而不添加任何项目符号?
答案1
如果您想要一个项目符号列表,但其中某些未加项目符号的项目缩进程度不如常规项目,则需要使用负缩进手动将它们推回。如果您希望整个列表不带项目符号且缩进量不大,则可以beamer
为该列表(可能嵌套)以及列表边距设置适当的模板。
以下是一个例子:
\documentclass{beamer}% http://ctan.org/pkg/beamer
\let\Tiny\tiny% http://tex.stackexchange.com/q/58087/5764
\begin{document}
\begin{frame}
\begin{itemize}
\item A sub-itemize
\begin{itemize}
\item an item with a bullet
\item[] items without a bullet waste space
\item[] \hspace*{-1em}\(\leftarrow\) here
\end{itemize}
\item A sub-list
\begin{list}{}{}
\item these items are too big
\item the sublist font should be smaller
\item[] \(\leftarrow\) still too much space
\end{list}
\end{itemize}
\setbeamertemplate{itemize subitem}{}% Remove bullets frp, ote,oze sinote,
\setlength\leftmarginii{0.5em}% Left margin of subitems
\begin{itemize}
\item A sub-itemize
\begin{itemize}
\item an item with a bullet
\item items without a bullet waste space
\item \(\leftarrow\) here
\end{itemize}
\end{itemize}
\end{frame}
\end{document}
对于第三个子项,负数\hspace{-1em}
将内容向后推1em
。最后一个列表的itemize subitem
模板设置为无(意味着不会显示项目符号),但左边距也设置为0.5em
,使项目出现的缩进较少。
各个嵌套列表的默认意图是2em
each (带有\labelsep
的.5em
)。以下详细信息取自beamerbaselocalstructure.sty
:
%
% List stuff
%
\setlength\leftmargini {2em}
\setlength\leftmarginii {2em}
\setlength\leftmarginiii {2em}
\setlength \labelsep {.5em}
\setlength \labelwidth{\leftmargini}
\addtolength\labelwidth{-\labelsep}
答案2
我采用了环境的定义itemize
并根据自己的喜好进行了修改。
合并后\list
可避免使用空的第一个参数创建任何项目符号,并且当前边距设置为固定宽度。
\documentclass{beamer}
\makeatletter
% This is itemize, stolen from beamer/base/beamerbaselocalstructure.sty
% but stripped from the bullets and their indentation.
\newcommand{\sub}[1][]{%
\beamer@ifempty{#1}{}{\def\beamer@defaultospec{#1}}%
\ifnum \@itemdepth >2\relax\@toodeep\else
\advance\@itemdepth\@ne
\beamer@computepref\@itemdepth% sets \beameritemnestingprefix
\usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
\usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
\usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
\setlength{\csname leftmargin\romannumeral\@itemdepth\endcsname}{.5em}%
\list{}%
{\def\makelabel##1{%
{%
\hss\llap{{%
\usebeamerfont*{itemize \beameritemnestingprefix item}%
\usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
}%
}%
}
\fi%
\beamer@cramped%
\raggedright%
\beamer@firstlineitemizeunskip%
}
\def\endsub{\enditemize} % recycle identical itemize end.
\makeatother
\begin{document}
\begin{frame}
\begin{itemize}
\item A sub-itemize
\begin{itemize}
\item an item with a bullet
\item[] items without a bullet waste space
\item[] \(\leftarrow\) here
\end{itemize}
\item A custom sublist
\begin{sub}
\item these items work like sub-itemize
\item but they waste no space
\item \(\leftarrow\) here
\begin{sub}
\item they even work when nested
\end{sub}
\end{sub}
\end{itemize}
\end{frame}
\end{document}