我想用纽卡斯尔大学的 LaTeX 投影仪模板制作一个演示文稿投影仪https://github.com/nitrogl/nclbeamer(Overleaf 中的类似模板
https://www.overleaf.com/latex/templates/university-of-york-un-official-beamer-template/gsmdqbkqkssm)。但是当我尝试创建一个定理(或定义、引理、推论……)时,它显示如图所示。我不知道为什么显示那一行,以及为什么文本从行尾开始。我想自定义这些环境,以便“定理”看起来像“alertblock”,
“定义”看起来像“exampleblock”,“引理”看起来像“blueblock”
% ----------------------------------------------------------------------
% Date: September 23th, 2016
% Author: Roberto Metere
% Project: Beamer template for Newcastle University
%
% Copyright (C) 2016-2018 Roberto Metere
% ----------------------------------------------------------------------
%
\documentclass[t,compress,9pt,aspectratio=169]{beamer}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[nclbghead]{nclbeamer}
\usepackage{listings}
% Set to 1 or comment to disable transparency and enable full opacity.
\setblockbodyopacity{0.5}
% Listings
\definecolor{cident}{rgb}{0,0.33,0.42}
\definecolor{ckeyw}{rgb}{0,0,0.8}
\definecolor{ccomm}{rgb}{0,0.8,0}
\definecolor{cstr}{rgb}{0.8,0,0}
\lstset{language=[LaTeX]{TeX},
basicstyle=\footnotesize\ttfamily,
keywordstyle=\color{ckeyw}\bfseries,
identifierstyle=\color{cident}\bfseries,
commentstyle=\color{ccomm},
stringstyle=\color{cstr},
showstringspaces=false,
breaklines=true,
breakatwhitespace=true,
tabsize=2,
% numbers=left,
% stepnumber=1,
% firstnumber=1,
% numberfirstline=true,
}
\nclsetidentity{School of}{Computing}
\title[Shorttitle]{\textbf{Title... \\ long title new line}}
\subtitle{Subtitle}
\author[Shortauthor]{Author \\ \small email: \href{mailto:[email protected]}{[email protected]}}
\institute{Newcastle University}
\date[1 Jan]{1 January, 1970}
% \setlength{\frametitlemargin}{1mm}
\begin{document}
% ==============================================================
% --- Welcome frame
% ==============================================================
\begin{frame}[plain]
\maketitle
\end{frame}
% ==============================================================
% --- TOC
% ==============================================================
\begin{frame}
\tableofcontents
\end{frame}
% ==============================================================
% --- Section 1
% ==============================================================
\section{Section1}
\begin{frame}
\frametitle{}
\begin{theorem}
the set of measurable
\end{theorem}
\begin{theorem}
Let $\frac{G}{\omega} \in (L^{m}(\Omega,\omega))^{N}$. Assuming that hold true. For $1 \leq p < \infty$ , we define $L^p(\Omega, \omega)$ as the set of measurable
\end{theorem}
\begin{definition}
Let $\Omega \subset \mathbb{R}^N$ be open,
\end{definition}
\begin{definition}
Let $\Omega \subset \mathbb{R}^N$ be open, and let $\omega$ be a weight. For $1 \leq p < \infty$ , we define $L^p(\Omega, \omega)$ as the set of measurable functions $f$ on $\Omega$ such that
\end{definition}
\end{frame}
%------------------------------------------------
%%%%============================================
\begin{frame}
\frametitle{}
\begin{lemma}
the set of measurable functions $f$ on $\Omega$ such that the set of measurable functions $f$ on $\Omega$ such that
\end{lemma}
\begin{proof}
bla bla bla
\end{proof}
\begin{corollary}
bla bla bla
\end{corollary}
\begin{fact}
bla bla
\end{fact}
\end{frame}
\subsection{Section1-1}
\begin{frame}
\frametitle{Blocks}
Additional blocks
\begin{itemize}
\item termblock
\item problock
\item conblock
\item yellowblock
\item blueblock
\end{itemize}
\end{frame}
\subsection{Section1-2}
\subsubsection{Section1-2-1}
\begin{frame}
\frametitle{Additional blocks}
\begin{block}{block}
\begin{itemize} \item text \end{itemize}
\end{block}
\begin{block}[green]{block[green] - all blocks support custom colours for item elements}
\begin{itemize} \item text \end{itemize}
\end{block}
\begin{exampleblock}{exampleblock}
\begin{itemize} \item text \end{itemize}
\end{exampleblock}
\begin{alertblock}{alertblock}
\begin{itemize} \item text \end{itemize}
\end{alertblock}
\end{frame}
\begin{frame}
\frametitle{Additional blocks}
\begin{blueblock}{blueblock}
\begin{itemize} \item text \end{itemize}
\end{blueblock}
\begin{yellowblock}{yellowblock}
\begin{itemize} \item text \end{itemize}
\end{yellowblock}
\begin{termblock}{termblock}
\begin{itemize} \item text \end{itemize}
\end{termblock}
\end{frame}
\begin{frame}
\frametitle{Additional blocks}
\begin{cleanblock}{cleanblock}
\begin{itemize} \item text \end{itemize}
\end{cleanblock}
\begin{whiteblock}{whiteblock}
\begin{itemize} \item text \end{itemize}
\end{whiteblock}
\begin{grayblock}{grayblock}
\begin{itemize} \item text \end{itemize}
\end{grayblock}
\end{frame}
\begin{frame}
\frametitle{Additional blocks}
\begin{problock}{problock}
\begin{itemize} \item text \end{itemize}
\end{problock}
\begin{conblock}{conblock}
\begin{itemize} \item text \end{itemize}
\end{conblock}
\end{frame}
\begin{frame}
\frametitle{Size always matters}
\begin{block}{block - long}
\begin{itemize}
\item blabla...
\item blabla...
\begin{itemize}
\item nested blabla...
\item nested blabla...
\end{itemize}
\item blabla...
\begin{itemize}
\item nested blabla...
\item nested blabla...
\item nested blabla...
\end{itemize}
\item blabla...
\item blabla...
\end{itemize}
\end{block}
\begin{block}{block - empty}
\end{block}
\end{frame}
\begin{frame}
\frametitle{Size always matters}
\begin{block}{block - longest}
\begin{itemize}
\item blabla...
\item blabla...
\begin{itemize}
\item nested blabla...
\item nested blabla...
\end{itemize}
\item blabla...
\begin{itemize}
\item nested blabla...
\item nested blabla...
\item nested blabla...
\end{itemize}
\item blabla...
\item blabla...
\item blabla...
\begin{itemize}
\item nested blabla...
\item nested blabla...
\item nested blabla...
\item nested blabla...
\end{itemize}
\end{itemize}
\end{block}
\end{frame}
\subsection{Section1-3}
\begin{frame}
\frametitle{slide title}
Bla bla bla...
\end{frame}
% ==============================================================
% --- Section 2
% ==============================================================
\section{Section2}
\begin{frame}
\frametitle{slide title}
Bla bla bla...
\end{frame}
\subsection{Section2-1}
\begin{frame}
\frametitle{slide title}
Bla bla bla...
\end{frame}
\subsection{Section2-2}
\begin{frame}
\frametitle{slide title}
Bla bla bla...
\end{frame}
% ==============================================================
% --- THE END
% ==============================================================
\begin{frame}
\framesingletitle{The END}
\begin{center}
\begin{minipage}{0.8\textwidth}
\quotesentence{%
``quotation'' [author]
}
\end{minipage}
\end{center}
\end{frame}
% -------------------------------------------------------------
\end{document}
答案1
您的主题有一个相当值得怀疑的想法,即重新定义环境block
,这是投影仪中的核心元素,例如用于创建定理等。
您可以恢复到定理开始时的原始定义(根据需要更改颜色):
\documentclass[t,compress,9pt,aspectratio=169]{beamer}
\usepackage[english]{babel}
\usepackage[nclbghead]{nclbeamer}
\makeatletter
\newcommand{\restorebeamerblock}{
\renewenvironment<>{block}[1]{%
\begin{actionenv}##2%
\def\insertblocktitle{##1\pgfsetfillopacity{0.5}}%
\par%
\usebeamertemplate{block begin}\pgfsetfillopacity{1}%
}
{\par%
\usebeamertemplate{block end}%
\end{actionenv}}
}
\AtBeginEnvironment{theorem}{%
\setbeamercolor{block title}{bg=red!75!black}
\setbeamercolor{block body}{bg=block title.bg!10!bg}
\restorebeamerblock
}
\AtBeginEnvironment{definition}{\restorebeamerblock}
\AtBeginEnvironment{proof}{\restorebeamerblock}
\AtBeginEnvironment{corollary}{\restorebeamerblock}
\AtBeginEnvironment{fact}{\restorebeamerblock}
\AtBeginEnvironment{lemma}{\restorebeamerblock}
\makeatother
\begin{document}
\begin{frame}
\begin{theorem}
the set of measurable
\end{theorem}
\begin{definition}
Let $\Omega \subset \mathbb{R}^N$ be open,
\end{definition}
\end{frame}
\end{document}