![列环境中 tikzboxes 的位置调整](https://linux22.com/image/455244/%E5%88%97%E7%8E%AF%E5%A2%83%E4%B8%AD%20tikzboxes%20%E7%9A%84%E4%BD%8D%E7%BD%AE%E8%B0%83%E6%95%B4%20.png)
我正在尝试调整框架的某些元素,但始终遇到一些我无法理解的问题。
\columns
我通过分割框架和添加一些标题来显示 2 个方程式框,并且我使用\tikzmarkin
强加的(相同)尺寸来正确显示框。
我不明白为什么:
- 与每列相关的“标题”位于不同的位置。
- 右侧的边距不受尊重,因此不对称(我以为它
\columns
会自动完成?) - 另外,我怎样才能使框与框架的中心线对齐?(难道不应该这样做吗
\columns[c]
?)
预先感谢您的帮助,
\documentclass[t]{beamer}
%%%%%% ENCODAGE %%%%%%%%%%%
\usepackage[utf8]{inputenc}
%%%%%% TIKZ %%%%%%%%%%%%%%%
\usepackage[beamer,customcolors,norndcorners]{hf-tikz}
%%%%%% OTHERS %%%%%%%%%%%%%
\usepackage{booktabs,calligra}
\usepackage{listings,stackengine}
\def\doubleunderline#1{\underline{\underline{#1}}}
\author{XXX}
\title{XXX}
\subtitle{XXX}
\institute [XXX] {XXX \\ XXX}
\date{\today}
%%%%%% DEFINITIONS %%%%%%%%%
\def\cmd#1{\texttt{\color{red}\footnotesize $\backslash$#1}}
\def\env#1{\texttt{\color{blue}\footnotesize #1}}
\definecolor{deepblue}{rgb}{0,0,0.5}
\definecolor{deepred}{rgb}{0.6,0,0}
\definecolor{deepgreen}{rgb}{0,0.5,0}
\definecolor{halfgray}{gray}{0.55}
\lstset{
basicstyle=\ttfamily\small,
keywordstyle=\bfseries\color{deepblue},
emphstyle=\ttfamily\color{deepred}, % Custom highlighting style
stringstyle=\color{deepgreen},
numbers=left,
numberstyle=\small\color{halfgray},
rulesepcolor=\color{red!20!green!20!blue!20},
frame=shadowbox,
}
%%%%%% VIDEO %%%%%%%%%%%%%%
\usepackage{multimedia}
%%%%%% BOX %%%%%%%%%%%%%%%%
\usepackage{fancybox}
\usepackage{varwidth}
\usepackage{subcaption}
\hfsetbordercolor{blue!50!black}
%%%%%% PGFPLOTS %%%%%%%%%%%%
\usepackage[export]{adjustbox}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\definecolor{mygreen}{RGB}{28,172,0} % color values Red, Green, Blue
\definecolor{mylilas}{RGB}{170,55,241}
\definecolor{BgYellow}{HTML}{FFF59C}
\definecolor{FrameYellow}{HTML}{F7A600}
\usepackage{pgf, tikz, adjustbox}
\usetikzlibrary{spy}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns, matrix, positioning}
\usetikzlibrary{decorations.markings, arrows.meta,
patterns.meta
}
\usepackage[most]{tcolorbox}
\tcbset{highlight math style={enhanced,colframe=red,colback=red!10!white,boxsep=0pt,sharp corners,
equal height group=C,
minimum for equal height group=C:1.5cm,
valign=center,
}}
\begin{document}
\begin{frame}{Formalisme physique}
\begin{columns}[c]
\begin{column}{.5\linewidth}
\centering {\color{deepblue} Problème de Stokes}
\vskip0.2cm
\begin{equation*}
\tikzmarkin<1->[set fill color=white, set border color=blue!50!black]{a}(0.1,-1.65)(-0.1,1.75)
\left\{
\begin{aligned}
0 &= - \frac{\partial P}{\partial r} + \mu \frac{\partial^2 u}{\partial z^2} \\
0 &= -\frac{\partial P}{\partial z} - \rho g \\
0 &= \frac{\partial {u}}{\partial {r}} + \frac{{u}}{{r}} + \frac{\partial {w}}{\partial {z}}\\
\end{aligned}
\right.
\tikzmarkend{a}
\end{equation*}
\end{column}
\begin{column}{.5\linewidth}
\centering {\color{deepblue} Conditions limites}
\vskip0.2cm
\begin{equation*}
\tikzmarkin<1->[set fill color=white, set border color=blue!50!black]{b}(0.1,-1.65)(-0.1,1.75)
\left\{
\begin{aligned}
{w}({z} = {h}) &= \frac{\partial {h}}{\partial {t}} + {u} \frac{\partial {h}}{\partial {r}} \\
{p}(z = {h}) &= {D} \left( \Delta^{2}_{{r}} {h}\right) + \rho g h+{P_0} \\
\doubleunderline{\sigma} \cdot \underline{n} &= - P_T \cdot \underline{n}\\
\end{aligned}
\right.
\tikzmarkend{b}
\end{equation*}
\end{column}
\end{columns}
\end{frame}
\end{document}
答案1
- 与每列相关的“标题”位于不同的位置。
由于标题和框之间的空间不同,列的高度也不同。由于您使用的是[c]
输入列,因此标题的高度不会相同
- 右侧的边距不受尊重,因此不对称(我以为 \columns 会自动执行此操作?)
边距会自动适应列的宽度,但如果将内容放入比列宽宽得多的列中,它将突出。Latex 会在日志文件中通知您有关 hbox 溢出的信息
- 另外,我怎样才能使框与框架的中心线对齐?(难道不应该通过 \columns[c] 来完成吗?)
居中列将使列彼此居中对齐。如果您希望内容位于框架的中心,请使用[c]
居中对齐框架。
为了扭曲盒子内的整个方程式(而不是像以前的问题那样只扭曲方程式内的部分方程式),我建议使用tcolorbox
:
\documentclass[t]{beamer}
%%%%%% ENCODAGE %%%%%%%%%%%
\usepackage[utf8]{inputenc}
%%%%%% TIKZ %%%%%%%%%%%%%%%
\usepackage[beamer,customcolors,norndcorners]{hf-tikz}
%%%%%% OTHERS %%%%%%%%%%%%%
\usepackage{booktabs,calligra}
\usepackage{listings,stackengine}
\def\doubleunderline#1{\underline{\underline{#1}}}
\author{XXX}
\title{XXX}
\subtitle{XXX}
\institute [XXX] {XXX \\ XXX}
\date{\today}
%%%%%% DEFINITIONS %%%%%%%%%
\def\cmd#1{\texttt{\color{red}\footnotesize $\backslash$#1}}
\def\env#1{\texttt{\color{blue}\footnotesize #1}}
\definecolor{deepblue}{rgb}{0,0,0.5}
\definecolor{deepred}{rgb}{0.6,0,0}
\definecolor{deepgreen}{rgb}{0,0.5,0}
\definecolor{halfgray}{gray}{0.55}
\lstset{
basicstyle=\ttfamily\small,
keywordstyle=\bfseries\color{deepblue},
emphstyle=\ttfamily\color{deepred}, % Custom highlighting style
stringstyle=\color{deepgreen},
numbers=left,
numberstyle=\small\color{halfgray},
rulesepcolor=\color{red!20!green!20!blue!20},
frame=shadowbox,
}
%%%%%% VIDEO %%%%%%%%%%%%%%
\usepackage{multimedia}
%%%%%% BOX %%%%%%%%%%%%%%%%
\usepackage{fancybox}
\usepackage{varwidth}
\usepackage{subcaption}
\hfsetbordercolor{blue!50!black}
%%%%%% PGFPLOTS %%%%%%%%%%%%
\usepackage[export]{adjustbox}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\definecolor{mygreen}{RGB}{28,172,0} % color values Red, Green, Blue
\definecolor{mylilas}{RGB}{170,55,241}
\definecolor{BgYellow}{HTML}{FFF59C}
\definecolor{FrameYellow}{HTML}{F7A600}
\usepackage{pgf, tikz, adjustbox}
\usetikzlibrary{spy}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns, matrix, positioning}
\usetikzlibrary{decorations.markings, arrows.meta,
patterns.meta
}
\usepackage[most]{tcolorbox}
\tcbset{highlight math style={enhanced,colframe=blue!50!black,colback=bg,boxsep=0pt,sharp corners,
equal height group=C,
minimum for equal height group=C:1.5cm,
valign=center,
}}
\begin{document}
\begin{frame}[c]
\frametitle{Formalisme physique}
\begin{columns}
\begin{column}{.41\linewidth}
\centering {\color{deepblue} Problème de Stokes}
\begin{tcolorbox}[ams equation*,colback=bg,colframe=blue!50!black,equal height group=C,valign=center,top=-.7\baselineskip]
\left\{
\begin{aligned}
0 &= - \frac{\partial P}{\partial r} + \mu \frac{\partial^2 u}{\partial z^2} \\
0 &= -\frac{\partial P}{\partial z} - \rho g \\
0 &= \frac{\partial {u}}{\partial {r}} + \frac{{u}}{{r}} + \frac{\partial {w}}{\partial {z}}\\
\end{aligned}
\right.
\end{tcolorbox}
\end{column}
\begin{column}{.65\linewidth}
\centering {\color{deepblue} Conditions limites}
\begin{tcolorbox}[ams equation*,colback=bg,colframe=blue!50!black,equal height group=C,valign=center,top=-.7\baselineskip]
\left\{
\begin{aligned}
{w}({z} = {h}) &= \frac{\partial {h}}{\partial {t}} + {u} \frac{\partial {h}}{\partial {r}} \\
{p}(z = {h}) &= {D} \left( \Delta^{2}_{{r}} {h}\right) + \rho g h+{P_0} \\
\doubleunderline{\sigma} \cdot \underline{n} &= - P_T \cdot \underline{n}\\
\end{aligned}
\right.
\end{tcolorbox}
\end{column}
\end{columns}
\end{frame}
\end{document}