请确保下面的代码在文章 Latex 类中完美运行,但是当我尝试将其放入 Beamer 的 IAStheme 中时,标签很奇怪。
代码
\documentclass[11pt]{beamer}
\usepackage[english,french]{babel}
% or whatever
\usepackage[utf8]{inputenc}
% or whatever
\usepackage{graphicx}
\usepackage{pgf}
\usepackage{pifont}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{tikz}
\usepackage{tkz-graph}
\setbeamertemplate{itemize item}[triangle]
\usetikzlibrary{shapes,topaths,fit,arrows.meta,backgrounds,calc,trees,hobby}
\usetikzlibrary{graphs,graphs.standard}
%\title[Identification In Digraph] % (optional, use only with long paper titles)
\definecolor{myblue}{RGB}{122,163,204}
\begin{document}
\begin{frame}
\frametitle{Locally transitive}
\begin{tikzpicture}[scale=0.8]
\SetGraphUnit{2}
\renewcommand*{\VertexLineColor}{black}
\renewcommand*{\VertexLightFillColor}{white}
\renewcommand*{\VertexSmallMinSize}{6pt}
\renewcommand*{\VertexLineWidth}{1pt}
%\SetVertexNoLabel
\GraphInit[vstyle=Welsh]
\Vertices{circle}{1,2,3,4,5,6,7} % the ... syntax doesn't work here
\AddVertexColor{myblue}{1,5}
\SetUpEdge[style={->,thick},color=black]
\foreach \i in {1,...,7}
{
\foreach
[evaluate=\j as \k using {ifthenelse(Mod(\i+\j,7)==0,int(\i+\j),int(Mod(\i+\j,7)))}]
\j in {1,2,3}
{
\Edge(\i)(\k)
}
}
\end{tikzpicture}
\end{frame}
\end{document}
我不知道如何设置正确的标签(即 1 2 ... 7)
答案1
尝试不使用以下内容进行编译babel
:
\documentclass[11pt]{beamer}
%\usepackage[english,french]{babel}
% or whatever
\usepackage[utf8]{inputenc}
% or whatever
%\usepackage{graphicx}
\usepackage{pgf}
\usepackage{pifont}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
%\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{tikz}
\usepackage{tkz-graph}
\setbeamertemplate{itemize item}[triangle]
\usetikzlibrary{shapes,topaths,fit,arrows.meta,backgrounds,calc,trees,hobby}
\usetikzlibrary{graphs,graphs.standard}
%\title[Identification In Digraph] % (optional, use only with long paper titles)
\definecolor{myblue}{RGB}{122,163,204}
\begin{document}
\begin{frame}
\frametitle{Locally transitive}
\begin{tikzpicture}[scale=0.8]
\SetGraphUnit{2}
\renewcommand*{\VertexLineColor}{black}
\renewcommand*{\VertexLightFillColor}{white}
\renewcommand*{\VertexSmallMinSize}{6pt}
\renewcommand*{\VertexLineWidth}{1pt}
%\SetVertexNoLabel
\GraphInit[vstyle=Welsh]
\Vertices{circle}{1,2,3,4,5,6,7} % the ... syntax doesn't work here
\AddVertexColor{myblue}{1,5}
\SetUpEdge[style={->,thick},color=black]
\foreach \i in {1,...,7}
{
\foreach
[evaluate=\j as \k using {ifthenelse(Mod(\i+\j,7)==0,int(\i+\j),int(Mod(\i+\j,7)))}]
\j in {1,2,3}
{
\Edge(\i)(\k)
}
}
\end{tikzpicture}
\end{frame}
\end{document}
答案2
编辑:
萨姆卡特找到问题的原因:包babel
。更具体地说,原因是french
使用选项。它覆盖了一些tikz
代码。为了解决这个问题,可以克服这个问题(对于大多数非英语 babel 选项)定义tikzlibrary
babel`。只需将其添加到使用的库中,问题就会解决:
\documentclass{beamer}
\usepackage[english,french]{babel}% <-- this MWE also work with babel
\usepackage{tkz-graph}
\usetikzlibrary{arrows.meta, babel}% <-- added babel library
\usepackage{pifont}
\usepackage{amsmath, amssymb, amsthm}
\usepackage{caption}
\begin{document}
\begin{frame}
\small
\begin{columns}
\begin{column}{0.45\linewidth}
\[
\forall~v\in V(T),~deg^-(v)=deg^+(v)
\]
\end{column}
\begin{column}{0.55\linewidth}
\begin{tikzpicture}
\SetGraphUnit{2}
\renewcommand*{\VertexLineColor}{white}
\renewcommand*{\VertexLightFillColor}{red}
\renewcommand*{\VertexLineWidth}{1pt}
\GraphInit[vstyle=Welsh]
\Vertices{circle}{1,2,3,4,5,6}
\AddVertexColor{blue}{5,1}
\SetUpEdge[style={-{Straight Barb[length=1mm,width=1.2mm]}, thick},color=red]
\foreach \v [count=\vi from 2] in {1,...,5}{
\foreach \vv in {\vi,...,6}{\Edge(\v)(\vv)};
};
\end{tikzpicture}
\end{column}
\end{columns}
\end{frame}
\end{document}
笔记:不加载已经加载的包beamer
(详情请查看beamer
文档)。尽可能简化序言。使用 LaTeX 语法来编写方程式。
由于特定beamer
主题不(公开)可用,我无法使用您的序言在 MWE 上进行测试。