句号停止 hspace

句号停止 hspace

出于某种原因,当我加上句号时,\hspace什么也不做(除非它足够大)

代码:

%\documentclass[12 pt,handout,notheorems]{beamer}
\documentclass[12 pt,handout,notheorems, serif]{beamer}
%\documentclass[12 pt]{article}
\usepackage{pgfpages}
\pgfpagesuselayout{resize to}[a4paper,landscape]
\usetheme{Boadilla}
\usefonttheme{professionalfonts} %To get the accents aligned correctly, albeit in Computer Modern Roman
\usepackage{cancel}
\usepackage{amsmath}
\usepackage{bm}
\begin{document}
    \begin{equation}
        \hspace{-0.21cm}
        \left[\cancelto{\mathbf{0}}{\frac{\partial\phi}{\partial\mathbf{x}}} - \bm{\lambda}\right]^{\textrm{T}}_{*,t_f}\delta\mathbf{x}_f + \cancelto{0}{\left[\frac{\partial\phi}{\partial t} + \mathcal{H}\right]_*}\delta t_f = 0 \rightarrow \lambda_1^*\left(t_f\right) = \lambda_2^*\left(t_f\right) = 0. %Period
    \end{equation}
    \begin{equation}
        \hspace{-0.21cm}
        \left[\cancelto{\mathbf{0}}{\frac{\partial\phi}{\partial\mathbf{x}}} - \bm{\lambda}\right]^{\textrm{T}}_{*,t_f}\delta\mathbf{x}_f + \cancelto{0}{\left[\frac{\partial\phi}{\partial t} + \mathcal{H}\right]_*}\delta t_f = 0 \rightarrow \lambda_1^*\left(t_f\right) = \lambda_2^*\left(t_f\right) = 0 %No period
    \end{equation}
\end{document}

输出: 在此处输入图片描述

有没有办法确保它\hspace确实发挥作用,而不受句点的干扰?

答案1

TeXbook 中解释了这个技巧。它需要在等式开头加上一个胶水团(不是负数,除非你想放在边距中),并在结尾处指定一个奇怪的胶水规范

\hspace{1000pt minus 1fill}

这会让 TeX 误以为方程很长,所以它会尝试将其压缩到一行中。在排版时,较大的收缩性可实现正常间距。

我还将\left-\right对改为\Biggl- \Biggr,这样第一个括号就不会太大,第二个括号与高度相匹配。但是,我认为\biggl-\biggr是合适的大小,如第二个等式所示。

\documentclass[12 pt,handout,notheorems, serif]{beamer}
%\documentclass[12 pt]{article}
\usepackage{pgfpages}
\pgfpagesuselayout{resize to}[a4paper,landscape]
\usetheme{Boadilla}
\usefonttheme{professionalfonts} %To get the accents aligned correctly, albeit in Computer Modern Roman
\usepackage{cancel}
\usepackage{amsmath}
\usepackage{bm}

\begin{document}

\begin{equation}
\hspace{0pt}
\Biggl[
  \cancelto{\mathbf{0}}{\frac{\partial\phi}{\partial\mathbf{x}}} - \bm{\lambda}
\Biggr]^{\mathrm{T}}_{*,t_f}\delta\mathbf{x}_f
+ \cancelto{0}{\Biggl[\frac{\partial\phi}{\partial t} + \mathcal{H}\Biggr]_*}\delta t_f
= 0 \rightarrow \lambda_1^*\left(t_f\right) = \lambda_2^*\left(t_f\right) = 0.
\hspace{1000pt minus 1fill}
\end{equation}

\begin{equation}
\hspace{0pt}
\biggl[
  \cancelto{\mathbf{0}}{\frac{\partial\phi}{\partial\mathbf{x}}} - \bm{\lambda}
\biggr]^{\mathrm{T}}_{*,t_f}\delta\mathbf{x}_f
+ \cancelto{0}{\biggl[\frac{\partial\phi}{\partial t} + \mathcal{H}\biggr]_*}\delta t_f
= 0 \rightarrow \lambda_1^*\left(t_f\right) = \lambda_2^*\left(t_f\right) = 0.
\hspace{1000pt minus 1fill}
\end{equation}

\end{document}

在此处输入图片描述

相关内容