如何在投影仪幻灯片中移动 PGF/TikZ 图像

如何在投影仪幻灯片中移动 PGF/TikZ 图像

我正在尝试调整投影仪演示中的图像大小和位置。对于大小调整,我使用了效果很好的调整框包。但是,我现在有一张幻灯片,我想将图形向右移动,因为它与文本行更吻合。但我不想在文本行之间(垂直方向)在图形长度(现在在右侧)上留出很大的间隙。

我尝试在图形前使用 \hspace,但出于某种原因,它只将其稍微向右移动(也稍微向下移动)。它似乎对可以移动的程度有某种限制。

我将非常感激您的建议。我是 Beamer 的新手,并且刚刚开始使用 Latex 进行演示。

\documentclass[aspectratio=169,xcolor=dvipsnames]{beamer}
\usetheme{Simple}

\usepackage{hyperref}
\usepackage{graphicx} % Allows including images
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{positioning}
\usepackage{adjustbox}
\usetikzlibrary{patterns}
\usepackage{stmaryrd}
\usepackage{xcolor}
\newcommand{\msc}[1]{\begin{center}MSC2000: #1.\end{center}}

\begin{document}

\begin{frame}{Proof of main result}
    \begin{enumerate}
    \setcounter{enumi}{1}
        \item Let $x,y,z \in V(G)$ and $G[\{x,y,z\}]$ be a triangle.
        
        Define for each colour $c$,
        $$\text{Net}_c(xyz,xy) = L_c(xz)+L_c(yz)-L_c(xy)$$
        
\definecolor{qqqqff}{rgb}{0,0,1}
\definecolor{ffcctt}{rgb}{1,0.8,0.2}
\definecolor{uququq}{rgb}{0.25098039215686274,0.25098039215686274,0.25098039215686274}

\begin{adjustbox}{max totalsize={0.3\textwidth}{.3\textheight},center}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm]
%\clip(-2.82,-8.2) rectangle (10.86,6.02);
\draw [line width=2pt,color=ffcctt] (3.88,1.96)-- (2.96,-0.7);
\draw [line width=2pt,color=qqqqff] (4.94,-0.68)-- (3.88,1.96);
\draw [line width=2pt,color=qqqqff] (4.94,-0.68)-- (2.96,-0.7);
\begin{scriptsize}
\draw [fill=uququq] (3.88,1.96) circle (2pt);
\draw[color=uququq] (3.9,2.35) node {z};
\draw [fill=uququq] (2.96,-0.7) circle (2pt);
\draw[color=uququq] (2.76,-0.31) node {x};
\draw [fill=uququq] (4.94,-0.68) circle (2pt);
\draw[color=uququq] (5.14,-0.29) node {y};
\end{scriptsize}
\end{tikzpicture}
\end{adjustbox}
        
        \item Let $H$ be a Hamilton cycle in $G$. Assume $H$ is not $d$-unbalanced.
        
        Pick $v \in V(G)$. Write $H =(v, x_1, x_2, ...., x_{n-1})$.
        
        \item Let $X = \Gamma(v)$
        
        $X^+ = \{x_i \in v(G) | x_{i-1} \in \Gamma(v)$
        
        We have $|X|, |X^+| \geq (\frac{1}{2} + {1}{2r})n +6dr^2$
        
        The number of triangles $vxy$ such that $xy\in E(H)$ is $\geq |X\cap X^+|$.
        
        
    \end{enumerate}
\end{frame}

\end{document}

编辑:我对 Beamer 不太熟悉,完全没有意识到代码编译需要样式文件。它们在这里。有三个文件。

%This file is named beamerthemeSimple.sty
\mode<presentation>
% Settings
\usetheme{Madrid}
\useinnertheme{circles}
% \useoutertheme{simpleinfo}
% \useoutertheme{miniframes} % Alternatively: miniframes, infolines, split
\usefonttheme{Simple}
\usecolortheme{DarkBlue}

% \setbeamertemplate{footline} % To remove the footer line in all slides uncomment this line
\setbeamertemplate{footline}[page number] % To replace the footer line in all slides with a simple slide count uncomment this line
\setbeamertemplate{navigation symbols}{} % To remove the navigation symbols from the bottom of all slides uncomment this line
\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamertemplate{enumerate items}[default]
% table of contents (overview)
\setbeamertemplate{section in toc}[sections numbered]
\setbeamertemplate{subsection in toc}[default]

\mode<all>

第二个:

%This file is called beamerfontthemeSimple.sty
\mode<presentation>

%%%%%%%%%%%% fonts

\setbeamerfont{structure}{family=\sffamily,series=\mdseries}

\setbeamerfont{title}{size=\LARGE,parent=structure}
\setbeamerfont{subtitle}{size=\normalsize,parent=title}

\setbeamerfont{date}{size=\scriptsize,series=\mdseries,parent=structure}
\setbeamerfont{author}{size=\Large,series=\mdseries,parent=structure}
\setbeamerfont{institute}{size=\scriptsize,series=\mdseries,parent=structure}

\setbeamerfont{section in toc}{size=\Large,parent=structure}
\setbeamerfont{section in head/foot}{size=\tiny,parent=structure}
\setbeamerfont{subsection in toc}{size=\large,parent={section in toc}}

\setbeamerfont{frametitle}{parent=structure,size=\LARGE}
\setbeamerfont{framesubtitle}{parent=frametitle,size=\Large}

\setbeamerfont{caption}{size=\footnotesize}
\setbeamerfont{item}{parent=structure,series=\mdseries}
\setbeamerfont{block title}{size=\large,series=\mdseries,parent={structure,block body}}

\mode
<all>

最后一个:

%This file is called beamercolorthemeDarkBlue.sty
\definecolor{InvisibleRed}{rgb}{0.92, 0.9, 0.9}
\definecolor{InvisibleGreen}{rgb}{0.9, 0.92, 0.9}
\definecolor{InvisibleBlue}{rgb}{0.9, 0.9, 0.92}

\definecolor{LightBlue}{rgb}{0.4, 0.55, 0.65}

\definecolor{MediumRed}{rgb}{0.92549, 0.34509, 0.34509}
\definecolor{MediumGreen}{rgb}{0.36862, 0.66666, 0.65882}
\definecolor{MediumBlue}{rgb}{0.01176, 0.31372, 0.43529}

\definecolor{DarkBlue}{rgb}{0.05, 0.15, 0.3} 

\usecolortheme[named=DarkBlue]{structure}

\setbeamercolor{palette primary}{bg=DarkBlue,fg=white}
\setbeamercolor{palette secondary}{bg=MediumBlue,fg=white}
\setbeamercolor{palette tertiary}{bg=LightBlue,fg=white}
\setbeamercolor{block title}{bg=MediumBlue}
\setbeamercolor{block body}{bg=InvisibleBlue}
\setbeamercolor{block title example}{bg=MediumGreen}
\setbeamercolor{block body example}{bg=InvisibleGreen}
\setbeamercolor{block title alerted}{bg=MediumRed}
\setbeamercolor{block body alerted}{bg=InvisibleRed}

编辑:根据要求,这是我希望的布局类型的草图:

草图

答案1

如果我正确理解了你的问题,那么你会得到这样的结果:

在此处输入图片描述

我擅自重写了您的图片代码,从序言中删除了由 beamer 加载的包(xcolorgraphicxhyperref)以及未使用的包(booktabsadjustbox)。使用adjustbox进行缩放tikzpicture不是一个好主意,图像没有任何缩放就很好:

\documentclass[aspectratio=169,xcolor=dvipsnames]{beamer}
%\usetheme{Simple}

\midrule and \bottomrule in tables
\usepackage{pgf,tikz}
\usetikzlibrary{arrows,
                patterns,
                positioning}
\usepackage{stmaryrd}

\definecolor{qqqqff}{rgb}{0,0,1}
\definecolor{ffcctt}{rgb}{1,0.8,0.2}
\definecolor{uququq}{rgb}{0.25098039215686274,0.25098039215686274,0.25098039215686274}

\begin{document}
\begin{frame}[fragile]
\frametitle{Proof of main result}
\begin{columns}
\begin{column}{0.75\textwidth}
    \begin{enumerate}
\item   Let $x,y,z \in V(G)$ and $G[\{x,y,z\}]$ be a triangle.

        Define for each colour $c$,
    \[
\text{Net}_c(xyz,xy) = L_c(xz)+L_c(yz)-L_c(xy)
    \]
\item   Let $H$ be a Hamilton cycle in $G$. Assume $H$ is not $d$-unbalanced.

        Pick $v \in V(G)$. Write $H =(v, x_1, x_2, ...., x_{n-1})$.

\item   Let $X = \Gamma(v)$

        $X^+ = \{x_i \in v(G) | x_{i-1} \in \Gamma(v)$

        We have $|X|, |X^+| \geq (\frac{1}{2} + {1}{2r})n +6dr^2$

        The number of triangles $vxy$ such that $xy\in E(H)$ is $\geq |X\cap X^+|$.
    \end{enumerate}
\end{column}
\begin{column}{0.25\textwidth}
    \scriptsize
    \centering
    \begin{tikzpicture}[
  line cap = round, 
 line join = round,
line width = 2pt,
    dot/.style = {circle, fill, inner sep=1.5pt},
every label/.append style = {text=black}
                        ]
\draw [ffcctt] (0,0)-- (1,3);
\draw [qqqqff] (1,3) coordinate[label=$z$] (c) -- 
               (2,0) coordinate[label=right:$y$] (b) -- 
               (0,0) coordinate[label= left:$x$] (a);
\foreach \i in {a,b,c}{\node[dot] at (\i) {};}
    \end{tikzpicture}
    \end{column}
\end{columns}
\end{frame}
\end{document}

附录: 您可能喜欢以下框架设计中的小变化:

在此处输入图片描述

\documentclass[aspectratio=169,xcolor=dvipsnames]{beamer}
\setbeamertemplate{itemize subitem}[circle] \everymath=\expandafter{\the\everymath\color{blue!40!black}}

\usepackage{tikz}
\usetikzlibrary{arrows,
                patterns,
                positioning}
\usepackage{stmaryrd}

\definecolor{qqqqff}{rgb}{0,0,1}
\definecolor{ffcctt}{rgb}{1,0.8,0.2}
\definecolor{uququq}{rgb}{0.25098039215686274,0.25098039215686274,0.25098039215686274}

\begin{document}
\begin{frame}[fragile]
\frametitle{Proof of main result}
\begin{columns}
\begin{column}{0.75\textwidth}
    \begin{enumerate}
\item   Let $x,y,z \in V(G)$ and $G[\{x,y,z\}]$ be a triangle.

        Define for each colour $c$,
    \[
\text{Net}_c(xyz,xy) = L_c(xz)+L_c(yz)-L_c(xy)
    \]
\item   Let $H$ be a Hamilton cycle in $G$:
        \begin{itemize}
    \item   Assume $H$ is not $d$-unbalanced.
    \item   Pick $v \in V(G)$. 
    \item   Write $H =(v, x_1, x_2, ...., x_{n-1})$.
        \end{itemize}
\item   Let $X = \Gamma(v)$
    \[
X^+ = \{x_i \in v(G) | x_{i-1} \in \Gamma(v)
    \]
        We have $|X|, |X^+| \geq (\frac{1}{2} + {1}{2r})n +6dr^2$

        The number of triangles $vxy$ such that $xy\in E(H)$ is $\geq |X\cap X^+|$.
    \end{enumerate}
\end{column}
\begin{column}{0.25\textwidth}
    \centering
    \begin{tikzpicture}[
  line cap = round, 
 line join = round,
line width = 2pt,
    dot/.style = {circle, fill, inner sep=1.5pt},
every label/.append style = {text=black}
                        ]
\draw [ffcctt] (0,0)-- (1,3);
\draw [qqqqff] (1,3) coordinate[label=$z$] (c) -- 
               (2,0) coordinate[label=right:$y$] (b) -- 
               (0,0) coordinate[label= left:$x$] (a);
\foreach \i in {a,b,c}{\node[dot] at (\i) {};}
    \end{tikzpicture}
    \end{column}
\end{columns}
\end{frame}
\end{document}

相关内容