LaTeX What is wrong in this Latex code?

  • Thread starter Thread starter EngWiPy
  • Start date Start date
  • Tags Tags
    Code Latex
AI Thread Summary
The discussion revolves around issues encountered when transitioning LaTeX code from the 'report' class to the 'beamer' class for creating slides. The user reports that the code works without errors in the 'report' class but generates errors when switched to 'beamer'. Key points include the use of various packages such as 'tikz', which is essential for creating graphics and tables in both classes. Another participant confirms that the code functions correctly using MikTeX 2.9 and TeXStudio, suggesting that the problem may lie in the user's LaTeX setup or specific configurations. The conversation emphasizes the importance of ensuring compatibility of packages and commands when changing document classes in LaTeX.
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
Views
3K
Replies
2
Views
3K
Replies
0
Views
5K
Replies
2
Views
5K
Replies
4
Views
4K
Back
Top