左对齐 tikzfigure

左对齐 tikzfigure

我正在 beamer 中创建一个包含两个小页面的框架,其中一个包含 tikzpicture,另一个包含要点。我希望 Tikzfigure 左对齐在标题下方,但我见过的其他关于对齐的问题只涉及文本。

如何将整个 Tikzfigure 与小页面的左侧对齐?

平均能量损失

\documentclass[11pt]{beamer}
\usepackage{tikz}
\usetikzlibrary{patterns}
\usetikzlibrary{decorations.pathreplacing,calligraphy}
\usetikzlibrary{calc}
\usepackage{xcolor}

\begin{document}

\begin{frame}{MWE}
\noindent\begin{minipage}[t]{.45\textwidth}
\textbf{Stuff}
    \begin{figure}
        \begin{tikzpicture}[scale=0.045]
            \node [right] at (34, 50) {\scriptsize stuff 1};
            \node [right] at (34, 107) {\scriptsize  stuff 2};
            \node [right] at (34, 120) {\scriptsize stuff 3};
            
            \draw [decorate, decoration={brace,amplitude=6pt,mirror}] (30,114) --  (30,126.5);
            \draw [decorate, decoration={brace,amplitude=6pt,mirror}] (30,100) --  (30,114);
            \draw [decorate, decoration={brace,amplitude=6pt,mirror}] (30,0) --  (30,100);
            
            \node [above] at (15, 114) {\scriptsize 12.5\%};
            \node [above] at (15, 102) {\scriptsize 14\%};
            
            \draw [pattern=north east lines, draw=black, pattern color=cyan, blend mode=multiply] (0, 114) -- (0, 126.5) -- (30, 126.5) -- (30, 114) -- (0, 114);
            \draw [pattern=north east lines, draw=black, pattern color=cyan, blend mode=multiply] (0, 100) -- (0, 114) -- (30, 114) -- (30, 100);
            \draw [] (0, 0) -- (0, 100) -- (30, 100) -- (30, 0) -- (0, 0);
        \end{tikzpicture}
    \end{figure}
    \end{minipage}\hspace{.05\textwidth}  % <--- space %\pause
 \begin{minipage}[t]{.4\textwidth}
 \textbf{Explanation}
 \begin{itemize}
     \item {\footnotesize point one}
     \item {\footnotesize point two }
 \end{itemize}
    \end{minipage}
\end{frame}
\end{document}

输出

在此处输入图片描述

答案1

在 beamer 中,没有标题的环境唯一figure能做的就是将内容居中。如果你不想让你的图像居中,我不会在以下figure环境中扭曲它:

\documentclass[11pt]{beamer}
\usepackage{tikz}
\usetikzlibrary{patterns}
\usetikzlibrary{decorations.pathreplacing,calligraphy}
\usetikzlibrary{calc}
\usepackage{xcolor}

\begin{document}

\begin{frame}{MWE}
\begin{columns}[onlytextwidth,T]
\begin{column}{.45\textwidth}
\textbf{Stuff}

        \begin{tikzpicture}[scale=0.045]
            \node [right] at (34, 50) {\scriptsize stuff 1};
            \node [right] at (34, 107) {\scriptsize  stuff 2};
            \node [right] at (34, 120) {\scriptsize stuff 3};
            
            \draw [decorate, decoration={brace,amplitude=6pt,mirror}] (30,114) --  (30,126.5);
            \draw [decorate, decoration={brace,amplitude=6pt,mirror}] (30,100) --  (30,114);
            \draw [decorate, decoration={brace,amplitude=6pt,mirror}] (30,0) --  (30,100);
            
            \node [above] at (15, 114) {\scriptsize 12.5\%};
            \node [above] at (15, 102) {\scriptsize 14\%};
            
            \draw [pattern=north east lines, draw=black, pattern color=cyan, blend mode=multiply] (0, 114) -- (0, 126.5) -- (30, 126.5) -- (30, 114) -- (0, 114);
            \draw [pattern=north east lines, draw=black, pattern color=cyan, blend mode=multiply] (0, 100) -- (0, 114) -- (30, 114) -- (30, 100);
            \draw [] (0, 0) -- (0, 100) -- (30, 100) -- (30, 0) -- (0, 0);
        \end{tikzpicture}
\end{column}

\begin{column}{.45\textwidth}
 \textbf{Explanation}
 \begin{itemize}
     \item {\footnotesize point one}
     \item {\footnotesize point two }
 \end{itemize}
\end{column}
\end{columns}    
\end{frame}
\end{document}

在此处输入图片描述

答案2

我可以使用 将整个图形向左推\flushleft。下面更新了代码。

\documentclass[11pt]{beamer}
\usepackage{tikz}
\usetikzlibrary{patterns}
\usetikzlibrary{decorations.pathreplacing,calligraphy}
\usetikzlibrary{calc}
\usepackage{xcolor}

\begin{document}

\begin{frame}{MWE}
\noindent\begin{minipage}[t]{.45\textwidth}
\textbf{Stuff}
    \begin{figure}\flushleft
        \begin{tikzpicture}[scale=0.045]
            \node [right] at (34, 50) {\scriptsize stuff 1};
            \node [right] at (34, 107) {\scriptsize  stuff 2};
            \node [right] at (34, 120) {\scriptsize stuff 3};
            
            \draw [decorate, decoration={brace,amplitude=6pt,mirror}] (30,114) --  (30,126.5);
            \draw [decorate, decoration={brace,amplitude=6pt,mirror}] (30,100) --  (30,114);
            \draw [decorate, decoration={brace,amplitude=6pt,mirror}] (30,0) --  (30,100);
            
            \node [above] at (15, 114) {\scriptsize 12.5\%};
            \node [above] at (15, 102) {\scriptsize 14\%};
            
            \draw [pattern=north east lines, draw=black, pattern color=cyan, blend mode=multiply] (0, 114) -- (0, 126.5) -- (30, 126.5) -- (30, 114) -- (0, 114);
            \draw [pattern=north east lines, draw=black, pattern color=cyan, blend mode=multiply] (0, 100) -- (0, 114) -- (30, 114) -- (30, 100);
            \draw [] (0, 0) -- (0, 100) -- (30, 100) -- (30, 0) -- (0, 0);
        \end{tikzpicture}
    \end{figure}
    \end{minipage}\hspace{.05\textwidth}  % <--- space %\pause
 \begin{minipage}[t]{.4\textwidth}
 \textbf{Explanation}
 \begin{itemize}
     \item {\footnotesize point one}
     \item {\footnotesize point two }
 \end{itemize}
    \end{minipage}
\end{frame}
\end{document}

相关内容