小页面内的列表与底部对齐

小页面内的列表与底部对齐

我正在尝试使用 latex 创建 beamer 演示文稿。我需要在一张幻灯片上展示一些代码片段,因此借助这个网站,我使用 minipages 和列创建了它们。

我创建了一个最小示例来展示以下行为,包括其产生的屏幕截图。

我认为应该可以将这 3 个代码清单稍微移到顶部,以便它们适合一张幻灯片。

我在这里尝试了一些建议,但没有取得好的结果。

任何帮助是极大的赞赏。

在此处输入图片描述

\documentclass{beamer}
% \documentclass[trans]{beamer} %om te printen!
% \transglitter etc: kunt ge pas zien op Full Screen (Ctrl+L)

\usepackage{etex}
\usepackage{graphicx,multicol}
\usepackage[all]{xy}
\usepackage{beamerouterthememiniframes, srcltx,hyperref}
\usepackage{bbding} % checkmark
\usepackage{xcolor}
\usepackage{listings}
\usepackage{color}
\usepackage{float}


\setbeamercolor{normal text}{fg=black!70}
\setbeamertemplate{navigation symbols}{}%geen navigatie
\setbeamertemplate{blocks}[rounded][shadow=true]

\setbeamercovered{dynamic} %te komen items in lichtgrijs
% \setbeamercolor{background canvas}{bg=black!0}%is wit

% \logo{\vspace{-1.2cm}\\
% \hfill\includegraphics[height=3cm]{VUB_schild}}
% plaatst het logo op elke slide onderaan

\newcommand{\Z}{\mathbb{Z}} \newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}} \newcommand{\N}{\mathbb{N}}
\newcommand{\C}{\mathbb{C}} \newcommand{\U}{\mathcal{U}}
\newcommand{\z}{\mathcal{Z}}


%%% Listing
\lstset{%
  % backgroundcolor=\color{yellow!20},%
  basicstyle=\small\ttfamily,%
  numbers=left,
  numberstyle=\tiny,
  stepnumber=1,
  numbersep=5pt,%
  belowcaptionskip=0em,
%  belowskip=-2em,
%  aboveskip=-2em,
}%

% Add your keywords here, and have this in a separate file
% and include it in your preamble
\lstset{emph={%
    atomic, receive, send%
  },emphstyle={\color{red}\bfseries}%
}%
% \columnsep=1.8cm %\columnseprule=.4pt

\title{Combining Actors and Software Transactional Memory}
\author{Christophe De Troyer}
\date{}
\begin{document}

\begin{frame}[fragile]{Dependency Introduction}
  \begin{minipage}[t]{\linewidth}
  \begin{columns}
    \column[t]{5cm}
    \begin{lstlisting}
// Actor A      
atomic {
  send b m;
}
    \end{lstlisting}
    \column[t]{5cm}
   Sending from inside atomic block makes that atomic block a dependee.    
  \end{columns}
\end{minipage}
\begin{minipage}[t]{\linewidth}
  \begin{columns}
    \column[t]{5cm}
    \begin{lstlisting}
// Actor B      
receive m {
  atomic {
    send c n;
  }
}      
    \end{lstlisting}
    \column[t]{5cm}
    Receiving a message from an atomic block makes the receiver dependent on
    that atomic block.    
  \end{columns}
\end{minipage}
\begin{minipage}[t]{\linewidth}
  \begin{columns}
    \column[t]{5cm}
    \begin{lstlisting}
// Actor C      
receive n {
  do_stuff();
}      
    \end{lstlisting}
    \column[t]{5cm}
    Dependencies piggyback on sends. \texttt{b} now depends on both atomic blocks.    
  \end{columns}
\end{minipage}
\end{frame}


\end{document}

答案1

我会扔掉小页面(column已经是了minipage)并且不会在顶部对齐。

\documentclass{beamer}
% \documentclass[trans]{beamer} %om te printen!
% \transglitter etc: kunt ge pas zien op Full Screen (Ctrl+L)

\usepackage{etex}
\usepackage{graphicx,multicol}
\usepackage[all]{xy}
\usepackage{beamerouterthememiniframes, srcltx,hyperref}
\usepackage{bbding} % checkmark
\usepackage{xcolor}
\usepackage{listings}
\usepackage{color}
\usepackage{float}


\setbeamercolor{normal text}{fg=black!70}
\setbeamertemplate{navigation symbols}{}%geen navigatie
\setbeamertemplate{blocks}[rounded][shadow=true]

\setbeamercovered{dynamic} %te komen items in lichtgrijs
% \setbeamercolor{background canvas}{bg=black!0}%is wit

% \logo{\vspace{-1.2cm}\\
% \hfill\includegraphics[height=3cm]{VUB_schild}}
% plaatst het logo op elke slide onderaan

\newcommand{\Z}{\mathbb{Z}} \newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}} \newcommand{\N}{\mathbb{N}}
\newcommand{\C}{\mathbb{C}} \newcommand{\U}{\mathcal{U}}
\newcommand{\z}{\mathcal{Z}}


%%% Listing
\lstset{%
  % backgroundcolor=\color{yellow!20},%
  basicstyle=\small\ttfamily,%
  numbers=left,
  numberstyle=\tiny,
  stepnumber=1,
  numbersep=5pt,%
  belowcaptionskip=0em,
%  belowskip=-2em,
%  aboveskip=-2em,
}%

% Add your keywords here, and have this in a separate file
% and include it in your preamble
\lstset{emph={%
    atomic, receive, send%
  },emphstyle={\color{red}\bfseries}%
}%
% \columnsep=1.8cm %\columnseprule=.4pt

\title{Combining Actors and Software Transactional Memory}
\author{Christophe De Troyer}
\date{}
\begin{document}

\begin{frame}[fragile]{Dependency Introduction}
  \begin{columns}
    \begin{column}{5cm}
\begin{lstlisting}
// Actor A      
atomic {
  send b m;
}
\end{lstlisting}
    \end{column}
    \begin{column}{5cm}
   Sending from inside atomic block makes that atomic block a dependee.    
 \end{column}
\end{columns}
  \begin{columns}
    \begin{column}{5cm}
\begin{lstlisting}
// Actor B      
receive m {
  atomic {
    send c n;
  }
}      
\end{lstlisting}
    \end{column}
    \begin{column}{5cm}
        Receiving a message from an atomic block makes
        the receiver dependent on that atomic block.
      \end{column}
  \end{columns}
  \begin{columns}
    \begin{column}{5cm}
\begin{lstlisting}
// Actor C      
receive n {
  do_stuff();
}      
\end{lstlisting}
    \end{column}
    \begin{column}{5cm}
      Dependencies piggyback on sends. \texttt{b} now depends on both
      atomic blocks.
    \end{column}
  \end{columns}
\end{frame}


\end{document}

相关内容