将对齐调整到项目大小列表中

将对齐调整到项目大小列表中
\documentclass{beamer}
\usetheme{CambridgeUS}
\useoutertheme{infolines}
\usepackage{tikz}
\usepackage{tabularx}
\usepackage{ragged2e}  

\begin{document}
\begin{frame}
\frametitle{Introduction}
 \begin{itemize}
        \item Text:
        \break
        \begin{itemize}
           \item \justify \textbf{What is lorem ipsum}: Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. \break
            \item \justify \textbf{why do you use it}:It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).

        \end{itemize}
        \break
        \end{itemize} 

\end{frame}
\end{document}

我使用该包ragged2e来对齐文本。但是当我使用\justify列表中的每个项目时,它前面的项目符号就会丢失

答案1

由于您可能不希望在幻灯片中间出现分页符,因此可以使用 来\parbox创建对齐文本块。请注意,LaTeX 使用\fussy\sloppy来启用对齐,尽管这是 的默认设置\parbox

\documentclass{beamer}
\usetheme{CambridgeUS}
\useoutertheme{infolines}
\usepackage{tikz}
\usepackage{tabularx}
%\usepackage{ragged2e}  
\begin{document}
\begin{frame}
\frametitle{Introduction}
 \begin{itemize}
        \item Text:
        \break
        \begin{itemize}
           \item \parbox[t]{\linewidth}{\textbf{What is lorem ipsum}: Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.} \break
            \item \parbox[t]{\linewidth}{\textbf{why do you use it}:It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).}

        \end{itemize}
        \break
        \end{itemize} 

\end{frame}
\end{document}

演示

答案2

编辑:显然我没有做功课,首先在这个网站上搜索。这个问题之前已经有人问过了,而且已经有了@GonzaloMedina 的回答。我只能假设我的答案被否决是由于重复,因为我的代码修复与@GonzaloMedina 的相同,除了 %\raggedright和 的顺序\justifying

我想澄清一下,我没有抄袭@GonzaloMedina。我的回答首先告诉 OP 使用\justifying而不是\justify@GonzaloMedina 的回答中甚至没有提到这一点。如果任何怀疑抄袭的人至少给我写一条评论,指出@GonzaloMedina 的答案,我将非常感激,这样我就可以相应地编辑我的帖子。


原始答案

首先要说的是:它是 \justifying,而不是 \justify

这样做是有原因的:你永远不应该在演讲中加入长段落!!!你希望观众做什么?他们应该阅读屏幕上的内容吗?还是他们应该一边听你一边盯着段落读?

\itemize为了得到不愉快的结果,让我们改变在中找到 的定义 beamerbaselocalstructure.sty

\documentclass{beamer}
\usepackage{blindtext}
\usepackage{ragged2e}
\makeatletter
\renewcommand{\itemize}[1][]{%
  \ifblank{#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}%
    \list
      {\usebeamertemplate{itemize \beameritemnestingprefix item}}
      {\def\makelabel##1{%
          {%
            \hss\llap{{%
                \usebeamerfont*{itemize \beameritemnestingprefix item}%
                \usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
          }%
        }%
      }
  \fi%
  \beamer@cramped%
%  \raggedright% <- commented out
  \justifying% <- changed here
  \beamer@firstlineitemizeunskip%
}
\makeatother

\begin{document}

\begin{frame}
\begin{itemize}
  \item \blindtext
  \item \blindtext
\end{itemize}
\end{frame}

\end{document}

逐项列出

相关内容