0

so basically I have a main thesis beamer project written in "Metropolis". Since, in the past months I have made a detailed presentation of a thesis chapter using beamer, I would like to employ the latter slides in the main Metropolis slideshow. Notice that the slides of the Thesis Chapter are autonomous (i.e. they contain a bibitem bibliography...) The slides of the Chapter are in a different style than the Metropolis (I guess it is Madrid). Now, following, overleaf instructions, 1) I downloaded the source of the thesis Chapter, 2) put it in the same file as the Metropolis main, 3) copy-pasted the preamble of the main of the thesis Chapter in the main of the Metropolis and 4) typed \include{amases21/main}, being amases21 thee folder where the thesis chapter (with its .eps figures and thee rest) lies.

To be concrete, after operation 3) described above, the preamble of the Metropolis main looks as follows:


\documentclass[10pt]{beamer}

\usetheme[progressbar=frametitle]{metropolis}
\usepackage{appendixnumberbeamer}

\usepackage{booktabs}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc}
\usepackage{amsmath}
\usepackage{verbatim}
\usetikzlibrary{arrows,shapes}
\usepackage[scale=2]{ccicons}
\usepackage{enumitem}

%%%%%% THE COPY-PASTED PREAMBLE OF THE THESIS CHAPTER STARTS HERE:

\mode<presentation>
{
  \usetheme{default}      % nebo zkuste Darmstadt, Madrid, Warsaw,...
  \usecolortheme{default} % nebo zkuste albatross, beaver, crane, ...
  \usefonttheme{default}  % nebo zkuste serif, structurebold, ...
  \setbeamertemplate{navigation symbols}{}
  \setbeamertemplate{caption}[numbered]
} 

\newenvironment{squareenv}{\only{\setbeamertemplate{items}[square]}}{}
\usepackage{amsthm}
\setbeamertemplate{theorems}[numbered] % to number

\usepackage{times}
\usepackage[most]{tcolorbox}
\usepackage{lmodern}
\newtcbox{\mybox}{blank, on line, opacitytext=0.5}
\usepackage{subfig}
\usepackage{arydshln}
\usepackage[edges]{forest}
\usepackage{tcolorbox}
\theoremstyle{plain} % insert bellow all blocks you want in italic
\usetikzlibrary{positioning,shadows,trees,overlay-beamer-styles}


\tikzset{
every node/.style={draw,text width=2cm,drop shadow},
style1/.style= {rectangle, rounded corners=2pt, thin,align=center,fill=green!30},
style2/.style= {rectangle, rounded corners=6pt, thin,align=center,fill=green!60},
style3/.style= {rectangle,thin,align=left,fill=pink!60},
style4/.style= {fill=#1, minimum height=9ex, anchor=base},
svisible on/.style={alt=#1{}{opacity=0,every shadow/.style={opacity=0}}}
}


\usepackage{xcolor}

\newcommand{\highlightred}[1]{%
  \colorbox{red!50}{$\displaystyle#1$}}
  
  \newcommand{\highlightyellow}[1]{%
  \colorbox{yellow!50}{$\displaystyle#1$}}
  
  \newcommand{\highlightgreen}[1]{%
  \colorbox{green!50}{$\displaystyle#1$}}
  
  \newcommand{\highlightblue}[1]{%
  \colorbox{blue!50}{$\displaystyle#1$}}
  
  \newcommand{\highlightpink}[1]{%
  \colorbox{pink!40}{$\displaystyle#1$}}
  
    \newcommand{\highlightorange}[1]{%
  \colorbox{orange!40}{$\displaystyle#1$}}
  
    \newcommand{\highlightcyan}[1]{%
  \colorbox{cyan!40}{$\displaystyle#1$}}
  
    \newcommand{\highlightbrown}[1]{%
  \colorbox{brown!40}{$\displaystyle#1$}}

\usetikzlibrary{arrows.meta, quotes,shapes}
\tikzstyle{every picture}+=[remember picture]
\tikzstyle{na} = [baseline=-.5ex]
\usepackage{graphicx}
\usepackage{tcolorbox}

\usepackage[english]{babel}
\newcommand{\indep}{\perp \!\!\! \perp}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage[T1]{fontenc}
\usepackage{lmodern}


%definice matematických prostředí
\newtheorem{veta}{Věta}
\newtheorem{lema}[veta]{Lemma}

%%%%%% THE COPY-PASTED PREAMBLE OF THE THESIS CHAPTER ENDS HERE

\usepackage{pgfplots}
\usepgfplotslibrary{dateplot}

\usepackage{xspace}
\newcommand{\themename}{\textbf{\textsc{metropolis}}\xspace}

\title{At the intersection between Machine Learning and
Econometrics: theory and applications}
\subtitle{}
\date{}
\author{Federico Nutarelli}
\institute{IMT School for Advanced Studies, Lucca}
\titlegraphic{
    \includegraphics[width=4cm]{Logo.png}
}

%%%% METROPOLIS SLIDE:
\begin{frame}{Overview}
Part 2 (Chapters 3-4), \textbf{\textsc{Machine Learning and Econometrics}}:
\vspace{1.2cm}
\\
\textbf{\textsc{RQ3:}} The power of Econometrics. How does market size impact on market innovation? \\~\\
\textbf{\textsc{RQ4:}} The combination of machine learning and economic intuition: an application
of matrix completion (MC) to economic complexity. Can ML help in developing a novel index of economic complexity?
\end{frame}

%%% MADRID SLIDE:

\begin{frame}[label=myframe]
\begin{tikzpicture}[remember picture,
level 1/.style={sibling distance=45mm},
edge from parent/.style={->,draw},
>=latex,node distance=1.4em]

% the initial tree ("root" and "text nodes")
\node[style1] {About $\varepsilon_{n,t}$}
child[svisible on=<2->] {node[style2] (c1) {$\overline{\varepsilon}_{n,t}=0$}}
child[svisible on=<3->] {node[style2] (c2) {\textbf{$\varepsilon_{n,t} \not\!\perp\!\!\!\perp \varepsilon_{n,s}$}}}
child[svisible on=<4->] {node[style2] (c3) {$\varepsilon_{n,t} \indep \underline{x}_{n,t}$}};


\begin{scope}[svisible on=<3->]
\node [style3,below=of c2,xshift=15pt] (c21) {take units $n \neq m$};
\node [style3,below=of c21] (c22) {times:\\ $t \neq s$};
\node [style3,below=of c22] (c23) {$\varepsilon_{n,t}\indep\varepsilon_{m,s}$};
\node [style3,below=of c23] (c24) {time dependence in \textbf{same unit}};

\foreach \value in {1,...,4}
  \draw[->] (c2.195) |- (c2\value.west);
\end{scope}


\end{tikzpicture}
\end{frame}

When I try to run the overall code, only the Metropolis part appears.

Now, I have first of all the suspect that the two different styles (Madrid and Metropolis) conflict in some way. Is there a way to combine the two smartly? Say: optimally I would like the slides of the thesis chapter to adapt to the Metropolis style.

EDIT: To be concrete, I will show you here the 2 different styles I mention: in the first one, METROPOLIS, the slides look like this: enter image description here whereas in Madrid, the slides look like this: enter image description here, but also like this (to give an idea of their diversity): enter image description here Of course, the two presentations are made of many more slides. My aim is to take the Madrid slides and paste them to the metropolis presentation possibly changing their style to metropolis. In other words, I would like to do either of the 2: 1) (not optimal solution) simply appending the Madrid style slides to the metropolis like slides; 2) (optimal solution) append the Madrid style slides to the metropolis like slides and convert their style to the metropolis style

For instance I tried to label a frame (as an example) on the Madrid slides and then include \loadpresentation{amases.tex} \againframe{myframe} in the metropolis, but does not work apparently

EDIT2: added in the code a slide of Madrid and a slide of metropolis.

Thank you,

Federico

4
  • Please post a compilable example that shows some output and maybe give us an illustration what you would like it to look like. You cannot simple past the preamble of another file in your file, because very likely a lot of thinks will be overridden then and packages will be loaded twice. If you want to insert some frames from another file, you can just copy the frames. They should then take over the design of the main file. Of couse, you would need to take over the defintions for custom macros as well. Commented Dec 12, 2021 at 15:17
  • @JasperHabicht thank you I am editing the question
    – Lusian
    Commented Dec 13, 2021 at 20:42
  • Okay, could you add to your code perhaps the code from a few slides from each of your presentations? Did you try to just past one of the slides from the other presentation to the first withough changing the preamble? Converting the style essentially only means that you change the style in the \usetheme macro. Commented Dec 13, 2021 at 20:54
  • @JasperHabicht yes I actually copy-pasted all slides. I will add to the code a slide of metropolis and a slide of Madrid
    – Lusian
    Commented Dec 13, 2021 at 21:03

1 Answer 1

1

Well, it is hard to give an ultimate answer, but what I can definitely say is that you cannot simply copy the whole preamble of some document and paste it into another document, since this will surely result in a mess of code, probably a lot of clashes of packages, options and defintions and it will very likely not result in what you intended.

Instead, I would suggest that you do the following:

  1. Do not copy anything from the other preamble to your document at first.

  2. Copy just the relevant slides to your document.

  3. Try to compile. You will probably get a lot of errors and warnings, but from these you will know which packages and macro defintions you need to copy from the other document to your preamble.

  4. Now, take a look into both preambles and check which packages and macro defintions you really need to take over and paste only these to the preamble of your document.

  5. Repeat steps 2 to 3 until everything is fine. Just go through the errors and warnings one by one. Some final adjustments may be needed to make everything perfect.

This is actually the only safe way to merge your two presentations without any problems.


In order to fix the code you posted, I can only give you some hints that may help you in addition:

  1. You already defined the theme using \usetheme in the second line of your code. So, the following lines from the preamble of the other document should be deleted since they will override these settings:

    \mode<presentation>
    {
      \usetheme{default}      % nebo zkuste Darmstadt, Madrid, Warsaw,...
      \usecolortheme{default} % nebo zkuste albatross, beaver, crane, ...
      \usefonttheme{default}  % nebo zkuste serif, structurebold, ...
      \setbeamertemplate{navigation symbols}{}
      \setbeamertemplate{caption}[numbered]
    } 
    
  2. The preamble from the other documents should be handled with care because it looks very messy to me: It got \usepackage{tcolorbox} three times, while it is sufficient to keep only \usepackage[most]{tcolorbox} once. It also has \usepackage{lmodern} twice, which you should, together with \usepackage{times}, delete in order not to mess with the default fonts of the metropolis theme.

  3. If you compile your document with XeLaTeX, you should delete \usepackage[utf8]{inputenc} and \usepackage[T1]{fontenc}.

But, as I said, these points are only to fix the most problematic parts and since I don't know your other slides, there may still be a lot of things to adjust. I would therefore strongly advise to adhere to the steps above instead of only to apply these few fixes.

You must log in to answer this question.

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