5

The following is giving the error message: Missing \endcsname inserted. \end{tikzcd}

\documentclass[size=8pt,print]{beamer}


\mode<article> {
    \usepackage{fullpage}
    \usepackage{pgf}
    \usepackage{hyperref}
    \usepackage{graphicx}
    % \usepackage{pstricks}
    \setjobnamebeamerversion{beamerexample2.beamer}
}
\newcommand{\hookuparrow}{\mathrel{\rotatebox[origin=c]{90}{$\hookrightarrow$}}}
\newcommand{\hookdownarrow}{\mathrel{\rotatebox[origin=c]{-90}{$\hookrightarrow$}}}
\mode<presentation> {
    \usetheme{AnnArbor}
    %\usetheme{Caparica}
    %\usetheme{Madrid}
    \usecolortheme{default}
    \setbeamercovered{highly dynamic}%{dynamic}%{transparent}
}


\usepackage[portuges,english]{babel} %% \usepackage[english]{babel}
\usepackage{xcolor}
%\usepackage{pstricks}
\usepackage{amsmath}
\usepackage{amsthm}
%\usepackage{amscd}
\usepackage{graphicx}
\usepackage{amsfonts}
\usepackage{amssymb}
%\usepackage[mathscr]{eucal}
%\usepackage[all]{xy}
\usepackage{hyperref}
\usepackage{tikz}
\usepackage{tikz-cd}
\usetikzlibrary{backgrounds,fit, matrix}
\usetikzlibrary{positioning}
\usetikzlibrary{calc,through,chains}
\usetikzlibrary{arrows,shapes,snakes,automata, petri}
\usepackage[boxsize=1.25em, centerboxes]{ytableau}
\usetikzlibrary{matrix}

\renewcommand{\baselinestretch}{1.5}







\begin{document}
\begin{frame}[fragile]
    
            \[
                \begin{tikzcd}
                        T_\rho O_\rho \arrow[r, hook] \arrow[d, "\simeq"] 
                        & T_\rho Hom(\Gamma, G) \arrow[r, hook] \arrow[d, "\simeq"] 
                        & T_\rho G^\Gamma \arrow[d, "\simeq"] \\
                        B^1(\Gamma, \mathfrak{g}_\rho) \arrow[r, hook]
                        & Z^1(\Gamma, \mathfrak{g}_\rho) \arrow[r, hook]
                        & C^1(\Gamma, \mathfrak{g}_\rho)
                    \end{tikzcd}
            \]
\end{frame}
\end{document}
2
  • Unrelated to your question, but you don't need \usepackage{xcolor} \usepackage{amsmath} \usepackage{amsthm} \usepackage{graphicx} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{hyperref} in beamer Commented Jul 30 at 7:46
  • @user88059 Welcome! There are still many irrelevant packages in your preamble, if you remove some of them to simplify and test, then you can get a minimal, thus know it's babel to be blame in this case. Commented Jul 30 at 7:46

2 Answers 2

6

Somewhere in your setup (not sure if it is portuges (option to babel)) the " ends up being an active char, which tikzcd does not like. The usual solution is to add

\usetikzlibrary{babel}

to the preamble.

In this case, it works here too.

1
  • Thank you so much! It worked. Commented Jul 30 at 8:01
2

Whenever you have babel in your document, you should load the TikZ library babel.

However, this doesn't free you from using fragile for frames containing a tikzcd environment. Can we do without fragile (that's very slow)?

Yes. You can substitute the "<label>" syntax with a key-value option. I chose to name them llabel (for “label on the left of the arrow”) and rlabel (for “label on the right of the arrow). In the code below, the last label has been put on the right just to show that it works. You also have to use \& instead of &.

I also purged all the unnecessary packages and provided a better definition for the arrow relations.

\documentclass[size=8pt,print]{beamer}

\mode<article> {
    \usepackage{fullpage}
    %\usepackage{pstricks}
    \setjobnamebeamerversion{beamerexample2.beamer}
}
\mode<presentation> {
    \usetheme{AnnArbor}
    %\usetheme{Caparica}
    %\usetheme{Madrid}
    \usecolortheme{default}
    \setbeamercovered{highly dynamic}%{dynamic}%{transparent}
}


\usepackage[portuges,english]{babel}
\usepackage{amssymb}
%\usepackage[mathscr]{eucal}
\usepackage{tikz}
\usetikzlibrary{
  babel, % <--- IMPORTANT
  cd, % <--- instead of tikz-cd
  backgrounds,
  fit,
  matrix,
  positioning,
  calc,
  through,
  chains,
  %arrows, % <--- OBSOLETE
  arrows.meta,
  shapes,
  snakes,
  automata,
  petri,
}
\usepackage[boxsize=1.25em, centerboxes]{ytableau}

\makeatletter
\newcommand{\hookuparrow}{\mathrel{\mathpalette\hook@arrow{90}}}
\newcommand{\hookdownarrow}{\mathrel{\mathpalette\hook@arrow{-90}}}
\newcommand{\hook@arrow}[2]{%
  \mspace{-3mu}%
  \raisebox{0.33333\depth}{%
    \rotatebox[origin=c]{#2}{$\m@th#1\mathstrut\mspace{-1mu}{\hookrightarrow}\mspace{-2mu}$}%
  }%
  \mspace{-3mu}%
}
\makeatother

\tikzcdset{
  llabel/.style="#1",
  rlabel/.style="#1"',
  ampersand replacement=\&,
}

\linespread{1.5}% <--- not \renewcommand{\baselinestretch}{1.5}


\begin{document}

\begin{frame}
\frametitle{Test}
    
\[
\begin{tikzcd}
  T_\rho O_\rho \arrow[r, hook] \arrow[d, llabel=\simeq] \&
  T_\rho Hom(\Gamma, G) \arrow[r, hook] \arrow[d, llabel=\simeq] \&
  T_\rho G^\Gamma \arrow[d, rlabel=\simeq]
  \\
  B^1(\Gamma, \mathfrak{g}_\rho) \arrow[r, hook] \&
  Z^1(\Gamma, \mathfrak{g}_\rho) \arrow[r, hook] \&
  C^1(\Gamma, \mathfrak{g}_\rho)
\end{tikzcd}
\]

$A \hookuparrow B \hookdownarrow C_{X \hookuparrow Y \hookdownarrow Z}$

Show the bounding boxes: \fboxsep=0pt \fboxrule=0.1pt 
\fbox{$\hookuparrow$}
\fbox{$\hookdownarrow$}

\end{frame}

\end{document}

output

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.