2

I try to use my custom style in beamer documnet, if I use not numbered definitions or another my custom style for theorems and exmaples

\begin{myDefinition*}{Sample Definition}
This is a sample definition.
\end{myDefinition*}

\begin{myExample*}{Sample Definition}
This is a sample definition.
\end{myExample*}

\begin{myQuestion*}{Sample Definition}
This is a sample definition.
\end{myQuestion*}

\begin{myTheorem*}{Sample Definition}
This is a sample definition.
\end{myTheorem*}

All works fine, but if I del *, so I want use numbered custom enviroments, I have the such errors:

Missing \endcsname inserted.

I think, this errors related to using a different language pack (when I re-define myDefinition style)

And first symbol of definition (description field after title) not shown... I don't understand, how to fix this trouble?

My preamble code:

\documentclass[aspectratio=169, 11pt]{beamer}

\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,russian]{babel}
\usepackage{lipsum}
\usefonttheme{professionalfonts}
\usepackage{concmath}
\usefonttheme{serif}
\usepackage{setspace}
\usepackage{indentfirst}
% \usepackage{enumitem}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{hyperref}
\hypersetup{
    pdftitle={Assignment},
    colorlinks=true, linkcolor=black!90,
    bookmarksnumbered=true,
    bookmarksopen=true
}
\usepackage[most,many,breakable]{tcolorbox}
\usepackage{ragged2e}
\usepackage{etoolbox}
\usepackage{tikz-cd}
\usepackage{varwidth}

\setstretch{1.0}

\setlength{\parindent}{1.15cm}

\setlength{\parskip}{4pt}
\setlength{\emergencystretch}{3em}

\expandafter\def\expandafter\normalsize\expandafter{%
    \normalsize
    \setlength\abovedisplayskip{4pt}
    \setlength\belowdisplayskip{4pt}
    \setlength\abovedisplayshortskip{4pt}
    \setlength\belowdisplayshortskip{4pt}
}

\makeatletter
\long\def\beamer@@frametitle[#1]#2{%
  \ifblank{#2}{}{%
    \ifnum\beamer@autobreakcount<2
    \gdef\insertframetitle{{%
      #2%
    }}%
    \gdef\beamer@frametitle{#2}%
    \gdef\beamer@shortframetitle{#1}%
    \fi%
  }%
}

\setbeamertemplate{frametitle}[default][center]

\setbeamersize{text margin left=2em,text margin right=2em}

\setbeamertemplate{itemize items}[circle]

\setbeamerfont{title}{size=\LARGE}
\setbeamerfont{subtitle}{size=\Large}
\setbeamerfont{frametitle}{size=\Large}
\setbeamerfont{block title}{size=\normalsize}
\setbeamerfont{footline}{size=\normalsize}

\usebeamercolor{structure}
\setbeamercolor{normal text}{fg=black}
\setbeamercolor{structure}{bg=black!20,fg=black}

% \addtobeamertemplate{frametitle}{}{\vspace*{-1ex}\rule{\textwidth}{1pt}}

\setbeamertemplate{navigation symbols}{}

\setbeamertemplate{section in toc}[sections numbered]

\setbeamertemplate{subsection in toc}[subsections numbered]

\setbeamertemplate{subsection in toc}{\leavevmode\leftskip=3.2em\rlap{\hskip-2em\inserttocsectionnumber.\inserttocsubsectionnumber}\inserttocsubsection\par}

\makeatletter

\define@key{beamerframe}{s}[true]{% stretch
  \beamer@frametopskip=8pt\relax%
  \beamer@framebottomskip=4pt plus 0.0001fill\relax%
  \beamer@frametopskipautobreak=\beamer@frametopskip\relax%
  \beamer@framebottomskipautobreak=\beamer@framebottomskip\relax%
}

\def\beamer@initfirstlineunskip{%
    \def\beamer@firstlineitemizeunskip{%
      \vskip-\partopsep\vskip-\topsep\vskip-\parskip%
      \global\let\beamer@firstlineitemizeunskip=\relax}%
    \everypar{\global\let\beamer@firstlineitemizeunskip=\relax}}

\setbeamertemplate{footline}{%
   \centering
   \begin{minipage}{\dimexpr\paperwidth-\beamer@leftmargin-\beamer@rightmargin\relax}
    % \vspace{-4ex}
   \centering
   \rule{\linewidth}{1pt} \vskip -2pt
   \usebeamerfont{footline}%
   \usebeamercolor{footline}%
   % \hfill\insertpagenumber/\inserttotalframenumber
   \hfill\insertpagenumber
   \hfill%
   \llap{\insertframenavigationsymbol\insertbackfindforwardnavigationsymbol}\par
   \end{minipage}\vskip4pt
}

\makeatother

\definecolor{mytheoremfr}{HTML}{00007B}

\tcbuselibrary{theorems,skins,hooks}
\newtcbtheorem[number within=section]{myDefinition}{Определение}{enhanced,
    before skip=2mm, after skip=2mm, colback=black!7, colframe=black!65!white, boxrule=0.3mm,
    attach boxed title to top left={xshift=1cm, yshift*=1mm-\tcboxedtitleheight}, varwidth boxed title*=-3cm,
    boxed title style={
        frame code={
            \path[fill=tcbcolback]
            ([yshift=-1mm,xshift=-1mm]frame.north west)
            arc[start angle=0, end angle=180, radius=1mm]
            ([yshift=-1mm,xshift=1mm]frame.north east)
            arc[start angle=180, end angle=0, radius=1mm];
            \path[left color=tcbcolback!45!white, right color=tcbcolback!45!white,
            middle color=tcbcolback!45!white]
            ([xshift=-2mm]frame.north west) -- ([xshift=2mm]frame.north east)
            [rounded corners=1mm]-- ([xshift=1mm,yshift=-1mm]frame.north east)
            -- (frame.south east) -- (frame.south west)
            -- ([xshift=-1mm,yshift=-1mm]frame.north west)
            [sharp corners]-- cycle;
        },
        interior engine=empty,
    },
    fonttitle= \itshape \bfseries \color{black},
    title={#2},#1
}{def}

\AtBeginSection[]{
  \begin{frame}
  \vfill
  \centering
  \begin{beamercolorbox}[sep=8pt,center,shadow=false,rounded=true]{title}
    \usebeamerfont{title}\insertsectionhead\par%
  \end{beamercolorbox}
  \vfill
  \end{frame}
}

\title{\textbf{Linear Algebra}}
\apptocmd{\frame}{}{\justifying}{}

\begin{document}

\begin{frame}
\thispagestyle{empty}
  \titlepage
\end{frame}

\section{Intro}

\subsection{Intro I}

\begin{frame}[s, allowframebreaks] \frametitle{Intro I}
\begin{myDefinition}{Вектор}
Бла Бла Бла.
\end{myDefinition}
\end{frame}
\end{document}

This picture shows my troubleshooting:

enter image description here

8
  • Can you please include one or more screenshots of your output? Thank you // BTW, your posted code can't compile, as it ends with \section{Mathematics}...
    – MS-SPO
    Commented Sep 2, 2023 at 11:50
  • 1
    Unrelated: you should clean up your preamble, lots of unnecessary packages Commented Sep 2, 2023 at 11:56
  • 1
    @MS-SPO Sorry, I edit my post
    – Alex
    Commented Sep 2, 2023 at 12:07
  • 1
    Why are you loading \tcbuselibrary{theorems,skins,hooks} 5 times? Commented Sep 2, 2023 at 12:12
  • 1
    It would be really nice if you would trim down your code to the parts relevant to your question before asking questions. How are several hundred lines of code about sections and frametitles in any way related to a problem with tcolorboxes? Commented Sep 2, 2023 at 12:26

1 Answer 1

4

Your syntax is wrong. Your custom theorems take two mandatory arguments, one for the title and one for the label. You can't just leave one out. At the very minimum, it can be empty, but it can't simply be missing.

\documentclass[aspectratio=169, 11pt]{beamer}

\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,russian]{babel}

\usepackage{tikz}
\usetikzlibrary{positioning}

\usepackage[most]{tcolorbox}
\usepackage{varwidth}
\definecolor{mytheoremfr}{HTML}{00007B}

\tcbuselibrary{theorems,skins,hooks}
\newtcbtheorem[number within=section]{myDefinition}{Определение}{enhanced,
    before skip=2mm, after skip=2mm, colback=black!7, colframe=black!65!white, boxrule=0.3mm,
    attach boxed title to top left={xshift=1cm, yshift*=1mm-\tcboxedtitleheight}, varwidth boxed title*=-3cm,
    boxed title style={
        frame code={
            \path[fill=tcbcolback]
            ([yshift=-1mm,xshift=-1mm]frame.north west)
            arc[start angle=0, end angle=180, radius=1mm]
            ([yshift=-1mm,xshift=1mm]frame.north east)
            arc[start angle=180, end angle=0, radius=1mm];
            \path[left color=tcbcolback!45!white, right color=tcbcolback!45!white,
            middle color=tcbcolback!45!white]
            ([xshift=-2mm]frame.north west) -- ([xshift=2mm]frame.north east)
            [rounded corners=1mm]-- ([xshift=1mm,yshift=-1mm]frame.north east)
            -- (frame.south east) -- (frame.south west)
            -- ([xshift=-1mm,yshift=-1mm]frame.north west)
            [sharp corners]-- cycle;
        },
        interior engine=empty,
    },
    fonttitle= \itshape \bfseries \color{black},
    title={#2},#1
}{def}



\begin{document}

\begin{frame} 

\begin{myDefinition}{Вектор}{quack}
Бла Бла Бла.
\end{myDefinition}

\ref{def:quack}

\begin{myDefinition}{Title}{}
Test
\end{myDefinition}

\end{frame}

\end{document}

enter image description here

1
  • 1
    Oh my God, what a stupid mistake, I'm so sorry and express my sincere gratitude!
    – Alex
    Commented Sep 2, 2023 at 12:48

You must log in to answer this question.

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