LaTeX投影仪:更改项目符号缩进的方法? [英] LaTeX beamer: way to change the bullet indentation?

查看:118
本文介绍了LaTeX投影仪:更改项目符号缩进的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经检查了Beamer Class手册(PDF文件).

I've checked the Beamer Class manual (PDF file).

我不知道如何更改分配给\ itemize的缩进项目符号.

I can't figure out how to change the indentation bullet assigns to \itemize.

[这很重要,因为我正在使用2列幻灯片,并且我不希望投影仪占用太多的水平空间].

[This is kind of important, as I'm using 2 column slides, and I don't want beamer to steal too much horizontal space].

推荐答案

Beamer只是将管理 itemize 环境的布局的职责委托给了基础LaTeX包,因此您无需做任何时髦的事情Beamer本身可以更改列表的外观/布局.

Beamer just delegates responsibility for managing layout of itemize environments back to the base LaTeX packages, so there's nothing funky you need to do in Beamer itself to alter the apperaance / layout of your lists.

由于Beamer重新定义了itemize,item等,因此完全正确的操作方式(如缩进)是重新定义Beamer模板.我得到的印象是您不希望走那么远,但是如果不是这样,请告诉我,我会详细说明.

Since Beamer redefines itemize, item, etc., the fully proper way to manipulate things like indentation is to redefine the Beamer templates. I get the impression that you're not looking to go that far, but if that's not the case, let me know and I'll elaborate.

至少有三种方法可以在文档中实现目标,而不会迷惑Beamer模板.

There are at least three ways of accomplishing your goal from within your document, without mussing about with Beamer templates.

在以下代码段中,您可以将 \ itemindent 的值从 0em 更改为任意值,包括负值. 0em 是默认的项目缩进.

In the following code snippet, you can change the value of \itemindent from 0em to whatever you please, including negative values. 0em is the default item indentation.

此方法的优点是列表的样式是正常的.缺点是Beamer对 itemize \ item 的重新定义意味着可以操纵以更改列表布局的参数的数量是有限的.多行项目很难保证正确的间距.

The advantage of this method is that the list is styled normally. The disadvantage is that Beamer's redefinition of itemize and \item means that the number of paramters that can be manipulated to change the list layout is limited. It can be very hard to get the spacing right with multi-line items.

\begin{itemize}
  \setlength{\itemindent}{0em}
  \item This is a normally-indented item.
\end{itemize}

使用 list

在以下代码段中, \ list 的第二个参数是要使用的项目符号,而第三个参数是要更改的布局参数的列表. \ leftmargin 参数调整整个列表项及其所有行的缩进; \ itemindent 更改后续行的缩进.

With list

In the following code snippet, the second parameter to \list is the bullet to use, and the third parameter is a list of layout parameters to change. The \leftmargin parameter adjusts the indentation of the entire list item and all of its rows; \itemindent alters the indentation of subsequent lines.

此方法的优点是您具有非Beamer LaTeX中列表的所有灵活性.缺点是您必须手动设置项目符号样式(和其他视觉元素)(或为所使用的模板标识正确的命令).请注意,如果将第二个参数留空,则不会显示任何项目符号,并且可以节省一些水平空间.

The advantage of this method is that you have all of the flexibility of lists in non-Beamer LaTeX. The disadvantage is that you have to setup the bullet style (and other visual elements) manually (or identify the right command for the template you're using). Note that if you leave the second argument empty, no bullet will be displayed and you'll save some horizontal space.

\begin{list}{$\square$}{\leftmargin=1em \itemindent=0em}
  \item This item uses the margin and indentation provided above.
\end{list}

定义自定义列表环境

可以通过定义一个新的 customlist 环境来改善 list 解决方案的缺点,该环境基本上从Beamer重新定义了 itemize 环境,但也合并了 \ leftmargin \ itemindent (等)参数.在您的序言中添加以下内容:

Defining a customlist environment

The shortcomings of the list solution can be ameliorated by defining a new customlist environment that basically redefines the itemize environment from Beamer but also incorporates the \leftmargin and \itemindent (etc.) parameters. Put the following in your preamble:

\makeatletter
\newenvironment{customlist}[2]{
  \ifnum\@itemdepth >2\relax\@toodeep\else
      \advance\@itemdepth\@ne%
      \beamer@computepref\@itemdepth%
      \usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
      \usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
      \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
      \begin{list}
        {
            \usebeamertemplate{itemize \beameritemnestingprefix item}
        }
        { \leftmargin=#1 \itemindent=#2
            \def\makelabel##1{%
              {%  
                  \hss\llap{{%
                    \usebeamerfont*{itemize \beameritemnestingprefix item}%
                        \usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
              }%  
            }%  
        }
  \fi
}
{
  \end{list}
  \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body end}%
}
\makeatother

现在,要使用带有自定义缩进的逐项列表,可以使用以下环境.第一个参数用于 \ leftmargin ,第二个参数用于 \ itemindent .默认值分别为2.5em和0em.

Now, to use an itemized list with custom indentation, you can use the following environment. The first argument is for \leftmargin and the second is for \itemindent. The default values are 2.5em and 0em respectively.

\begin{customlist}{2.5em}{0em}
   \item Any normal item can go here.
\end{customlist}

可以使用 \ setbeamertemplate 的标准Beamer机制将自定义项目符号样式合并到 customlist 解决方案中.(有关更多信息,请参见问题的答案.信息.)

A custom bullet style can be incorporated into the customlist solution using the standard Beamer mechanism of \setbeamertemplate. (See the answers to this question on the TeX Stack Exchange for more information.)

或者,可以通过在环境中直接修改项目符号样式,方法是将 \ usebeamertemplate {itemize \ beameritemnestingprefix item} 替换为您想要使用的项目符号样式(例如 $\ square $ ).

Alternatively, the bullet style can just be modified directly within the environment, by replacing \usebeamertemplate{itemize \beameritemnestingprefix item} with whatever bullet style you'd like to use (e.g. $\square$).

这篇关于LaTeX投影仪:更改项目符号缩进的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆