What is wrong in this Latex code?

  • Context: LaTeX 
  • Thread starter Thread starter EngWiPy
  • Start date Start date
  • Tags Tags
    Code Latex
Click For Summary
SUMMARY

The discussion centers on issues encountered when switching a LaTeX document from the "report" class to the "beamer" class for creating slides. Users reported errors related to specific packages and commands that are incompatible with the beamer class. The successful compilation of the original code was confirmed using MikTeX 2.9 and TeXStudio, indicating that the problem lies in the transition to beamer rather than the code itself. Key solutions include commenting out incompatible packages and ensuring proper beamer syntax.

PREREQUISITES
  • Familiarity with LaTeX document classes, specifically "report" and "beamer".
  • Understanding of LaTeX packages such as "tikz" and "graphicx".
  • Knowledge of LaTeX syntax for creating figures and tables.
  • Experience with LaTeX editors like TeXStudio and distributions like MikTeX.
NEXT STEPS
  • Research "beamer class documentation" for specific commands and environments.
  • Learn about "tikz" compatibility with beamer for creating graphics.
  • Explore "LaTeX error handling" techniques to troubleshoot compilation issues.
  • Investigate "LaTeX package compatibility" to avoid conflicts when switching document classes.
USEFUL FOR

LaTeX users, particularly those transitioning from document classes to presentation formats, educators preparing slides, and researchers needing to visualize complex data using TikZ.

EngWiPy
Messages
1,361
Reaction score
61
Hi,

I have the following Latex code, which is perfectly working under the class report, but when I change the class report to beamer to make slides, I get errors. Why?

Code:
\documentclass{report}
%\documentclass{beamer}
%\setbeamertemplate{navigation symbols}{}
%\setbeamercovered{transparent}
\usepackage[autostyle]{csquotes}
%\usepackage{beamerthemeshadow}
\usepackage{pst-sigsys}
\usepackage{setspace}
\usepackage{dsfont}
%\usepackage[top=2.3cm, bottom=2.5cm, left=2.5cm, right=2.5cm]{geometry}
\usepackage{enumerate}
\usepackage{amsmath}
%\usepackage{mathtools}
\usepackage{graphicx}
\usepackage[hang,scriptsize,bf]{caption}
\usepackage{lettrine}
\usepackage{amsfonts}
\usepackage[printonlyused]{acronym}
\usepackage{amssymb}
\usepackage{multirow}
\usepackage{pifont}
\usepackage{tikz}
\usepackage{epstopdf}
\usepackage{psfrag}
\usepackage{epsfig}
\usepackage[english]{babel}
\usepackage{longtable}
\usepackage{setspace}
\usepackage[autostyle]{csquotes}
\usepackage{fancybox}
%\usecolortheme{crane}
\usetikzlibrary{positioning}
\usetikzlibrary{shapes,arrows,fadings, shadows}
\usetikzlibrary{matrix}

\begin{document}

\tikzset{ 
    table/.style={
        matrix of nodes,
        row sep=-\pgflinewidth,
        column sep=-\pgflinewidth,
        nodes={
            rectangle,
            draw=black,
            align=center
        },
        minimum height=1.5em,
        text depth=0.5ex,
        text height=2ex,
        nodes in empty cells,
%%
        %every even row/.style={
            %nodes={fill=gray!20}
        %},
        column 1/.style={
            nodes={text width=2em,fill=gray!20,font=\bfseries,align=center}
        },
				column 2/.style={
            nodes={text=red}
        },
				column 3/.style={
            nodes={text=blue}
        },
				column 5/.style={
            nodes={text=violet}
        },
        %row 6/.style={
            %nodes={
                %fill=gray!20,
                %%text=black,
                %font=\bfseries
            %}
        %},
				row 5/.style={
            nodes={
                fill=black,
                text=white,
								align=left,
                font=\bfseries
            }
        },
    }
}


%\begin{frame}
%\frametitle{Combining Scheme}
\begin{figure}
\begin{center}
\begin{tikzpicture}

\matrix (first) [table,text width=6em]
{
$\mathbf{x}^{(1)}$   & $x_0^{(1)}$            & $x_1^{(1)}$ & $\cdots$ & $x_{N-1}^{(1)}$ \\
$\mathbf{x}^{(2)}$   & $x_0^{(2)}$            & $x_1^{(2)}$ & $\cdots$ & $x_{N-1}^{(2)}$ \\
$\vdots$             & $\vdots$               & $\vdots$    & $\ddots$ & $\vdots$ \\
$\mathbf{x}^{(M)}$   & |[name=a1]|$x_0^{(M)}$ & |[name=a2]|$x_1^{(M)}$ & $\cdots$ & |[name=a3]|$x_{N-1}^{(M)}$ \\[10mm]
                     & |[name=b1]| & |[name=b2]|&  & |[name=b3]| \\[10mm]
$\mathbf{x}^{(R)}$   & |[name=c1]|$x_0^{(R)}$ & |[name=c2]|$x_1^{(R)}$ & $\cdots$ & |[name=c3]|$x_{N-1}^{(R)}$ \\
};
\draw[->,thick] (a1) edge (b1);
\draw[->,thick] (b1) edge (c1);
\draw[->,thick] (a2) edge (b2);
\draw[->,thick] (b2) edge (c2);
\draw[->,thick] (a3) edge (b3);
\draw[->,thick] (b3) edge (c3);

\end{tikzpicture}
\end{center}
\end{figure}
%\end{frame}

\end {document}

I comment the beamer class and the commands associated with it.

Thanks in advance for your help
 
Physics news on Phys.org
Your code works for me. I got no error messages with MikTeX 2.9 using TeXStudio.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 0 ·
Replies
0
Views
6K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 4 ·
Replies
4
Views
5K