我正在尝试在 beamer 模板上的图形下放置 2 个高度相似的框。经过多次建议,一位用户建议我使用hf-tikz
。但是当我将它用于图形下的方程式时,它一直在框住上面的图像而不是方程式。
但是通过删除图像,它会绘制所需的结果:它是否与使用有关figure
?
谢谢你,
\documentclass{beamer}
\usepackage[beamer,customcolors,nofill,norndcorners]{hf-tikz}
\hfsetbordercolor{blue!50!black}
\begin{document}
\begin{frame}{Méthode de mesure}
\begin{figure}[!ht]
\centering
\subfloat[\centering Cas à une interface ]{{\includegraphics[width=0.45 \linewidth ]{pic/FCD1.png} }}%
\qquad
\subfloat[\centering Cas pour n interfaces]{{\includegraphics[width=0.45 \linewidth]{pic/FCD2.png} }}%
\caption{2 La démodulation en motif de Schlieren}%
\label{fig:example}%
\end{figure}
$\displaystyle\tikzmarkin<1->{a}(0.1,-0.4)(-0.1,0.6)
\nabla \zeta_0 = -\frac{\delta r}{h^{*}} \ \text{avec :}\ \frac{1}{h^{*}} = \frac{1}{\alpha h_p} - \frac{1}{H}
\tikzmarkend{a}
$
\hfill
$\displaystyle\tikzmarkin<1->{b}(0.1,-0.4)(-0.1,0.6)
\alpha = 1 - \frac{n}{n'} \ \text{et :} \ h_p = h_0
\tikzmarkend{b}
$
\end{frame}
\end{document}
编辑:使用的包:
%%%%%% ENCODAGE %%%%%%%%%%%
\usepackage[utf8]{inputenc}
%%%%%% TIKZ %%%%%%%%%%%%%%%
\usepackage[beamer,customcolors,nofill,norndcorners]{hf-tikz}
%%%%%% OTHERS %%%%%%%%%%%%%
\usepackage{booktabs,calligra}
\usepackage{listings,stackengine}
\author{XXX}
\title{XXX}
\subtitle{XXX}
\institute [XXX] {XXX \\ XXX}
\date{\today}
%%%%% GITHUB %%%%%%%%
\usepackage{YTU}
%%%%%% 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}
\pgfmathdeclarefunction{gaussian}{2}
{%
\pgfmathparse{(1/(#1 * sqrt(2 * pi))) * exp((-1 / 2) * (((x - #2)/#1) ^ 2))}%
}
\pgfmathsetmacro{\mean}{7}
\pgfmathsetmacro{\std}{0.3}
\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{arrows.meta,
patterns.meta
}
答案1
问题与盒子无关,subcaption
包裹丢失了。
这将通过日志文件中的错误显示出来。出现错误后,Latex 只能恢复到足以对文档的其余部分进行语法检查的程度,而不一定能产生合理的输出。
其他的建议:
- beamer 没有浮动机制,指定浮动说明符是没有意义的,例如
[!ht]
- beamer 自动将环境内容置于中心
figure
,\centering
没有必要
\documentclass{beamer}
\usepackage[beamer,customcolors,nofill,norndcorners]{hf-tikz}
\hfsetbordercolor{blue!50!black}
\usepackage{subcaption}
\begin{document}
\begin{frame}{Méthode de mesure}
\begin{figure}
\subfloat[Cas à une interface ]{\includegraphics[width=0.45 \linewidth]{example-image-duck}}%
\hfill
\subfloat[Cas pour n interfaces]{\includegraphics[width=0.45 \linewidth]{example-image-duck}}%
\caption{2 La démodulation en motif de Schlieren}%
\label{fig:example}%
\end{figure}
$\displaystyle\tikzmarkin<1->{a}(0.1,-0.4)(-0.1,0.6)
\nabla \zeta_0 = -\frac{\delta r}{h^{*}} \ \text{avec :}\ \frac{1}{h^{*}} = \frac{1}{\alpha h_p} - \frac{1}{H}
\tikzmarkend{a}
$
\hfill
$\displaystyle\tikzmarkin<1->{b}(0.1,-0.4)(-0.1,0.6)
\alpha = 1 - \frac{n}{n'} \ \text{et :} \ h_p = h_0
\tikzmarkend{b}
$
\end{frame}
\end{document}