1

I want to make a presentation beamer with Newcastle University LaTeX beamer template https://github.com/nitrogl/nclbeamer (similar template in Overleaf https://www.overleaf.com/latex/templates/university-of-york-un-official-beamer-template/gsmdqbkqkssm). But when I try to make a theorem ( or definition, lemma, corollary ...) it shows like in the picture. I don't know why that line shows and why the text starts from the end of the line. I want to customize these environments so that "theorem" looks like the "alertblock"
"definition" looks like the "exampleblock" "lemma" looks like the "blueblock" enter image description here

   % ----------------------------------------------------------------------
% 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}
4
  • 2
    Welcome! Please provide code for the document you compiled to produce the output shown.
    – cfr
    Nov 21, 2023 at 0:51
  • Beamer redefine so many macros it is effectively a different language than LaTeX. Nov 21, 2023 at 0:54
  • You can work on this template in Overleaf overleaf.com/latex/templates/…. they are the same
    – Iccu-Maths
    Nov 21, 2023 at 0:57
  • 1
    @Iccu-Maths Please include a small, but compilable test document in your question. Questions on tex.se should be self-sustained to ensure that they will remain useful for future users even if your links stop working. Nov 21, 2023 at 8:48

1 Answer 1

0

Your theme had the rather questionable idea to redefine the block environment, a central element in beamer, which is e.g. used to create theorems etc.

You can revert back to the original definition at the start of your theorems (change the colours as you like):

\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}

enter image description here

4
  • Thank you very much; it worked. It's been more than a week, and I'm searching for the solution. Thanks again. Another question is: can I get transparency in these blocks like in the other blocks in this template (example block, alert block ......)?
    – Iccu-Maths
    Nov 21, 2023 at 12:21
  • @Iccu-Maths Sure, see my edited answer Nov 21, 2023 at 12:30
  • I am grateful for your help. thanks
    – Iccu-Maths
    Nov 21, 2023 at 12:52
  • @Iccu-Maths You're welcome! Have fun with beamer! Nov 21, 2023 at 12:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .