使用对齐环境的大空格

使用对齐环境的大空格

我正在尝试使用对齐模式排版一系列不等式,如下面的 MWE 所示

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{hyperref}


\begin{document}
\begin{align}
    0.9 &\leq a_t, d_t &\leq 1.1 \label{zoom}\\
    -0.1 &\leq b_t, c_t &\leq 0.1 \label{rotation}\\
    -0.05 &\leq b_t + c_t &\leq 0.05 \label{limit_skew}\\
    -0.1 &\leq a_t - d_t &\leq 0.1 \label{non_uniform_scale}.
\end{align}

\end{document}

我得到的结果看起来像

在此处输入图片描述

变量和第二个符号之间的空白太多\leq。下面的变体对我来说也不起作用,

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{hyperref}


\begin{document}
\begin{align}
    0.9 &\leq a_t, d_t \leq &1.1 \label{zoom}\\
    -0.1 &\leq b_t, c_t \leq &0.1 \label{rotation}\\
    -0.05 &\leq b_t + c_t \leq &0.05 \label{limit_skew}\\
    -0.1 &\leq a_t - d_t \leq &0.1 \label{non_uniform_scale}.
\end{align}

\end{document}

答案1

也许你想要这样的东西? 在此处输入图片描述

\documentclass{article}
\usepackage{amsfonts}
\usepackage{amsmath}

\newsavebox\tempbox
\newcommand\fitbox[2][a_t-d_t]{
  \savebox{\tempbox}{$#1$}
  \makebox[\wd\tempbox][c]{$#2$}
}

\begin{document}
\begin{align}
  0.9 &\leq \fitbox{a_t, d_t} \leq 1.1 \\
  -0.1 &\leq \fitbox{b_t, c_t} \leq 0.1 \\
  -0.05 &\leq \fitbox{b_t + c_t} \leq 0.05 \\
  -0.1 &\leq \fitbox{a_t - d_t} \leq 0.1
\end{align}
\begin{align}
  0.9 &\leq \fitbox{a_t\hfill,\hfill d_t} \leq 1.1 \\
  -0.1 &\leq \fitbox{b_t\hfill,\hfill c_t} \leq 0.1 \\
  -0.05 &\leq \fitbox{b_t + c_t} \leq 0.05 \\
  -0.1 &\leq \fitbox{a_t - d_t} \leq 0.1
\end{align}
\end{document}

添加

如果您想要更多控制权... 在此处输入图片描述

\documentclass{article}
\usepackage{amsfonts}
\usepackage{amsmath}

\newsavebox\tempbox
\makeatletter
\newcommand\threepart[4][\fit@sep]{
  #2 \mspace{#1 mu} &\le \mspace{#1 mu} \fitbox{#3} \mspace{#1 mu} \le \mspace{#1 mu} #4
}
\newcommand\fitbox[1]{
  \makebox[\wd\tempbox][c]{$#1$}
}
\newcommand\myfitset[1]{
  \savebox{\tempbox}{$#1$}
}
\newcommand\myfitsep[1]{\def\fit@sep{#1}}
\makeatother
\myfitsep{0}
\myfitset{a_t - d_t}

\begin{document}
\begin{align}
  \threepart{0.9}{a_t\hfill,\hfill d_t}{1.1} \\
  \threepart{-0.1}{b_t\hfill,\hfill c_t}{0.1} \\
  \threepart{-0.05}{b_t + c_t}{0.05} \\
  \threepart{-0.1}{a_t - d_t}{0.1}
\end{align}
\centering
Increase the space around.
\myfitsep{6} % increase space
\begin{align}
  \threepart{0.9}{a_t\hfill,\hfill d_t}{1.1} \\
  \threepart{-0.1}{b_t\hfill,\hfill c_t}{0.1} \\
  \threepart{-0.05}{b_t + c_t}{0.05} \\
  \threepart{-0.1}{a_t - d_t}{0.1}
\end{align}
\end{document}

答案2

这是一个使用alignat环境而不是align环境的解决方案。(要确定的参数alignat,需要计算任意行中的最大 s 数(此处为 3),加 1,然后除以 2。由于 (3+1)/2=2,因此在以下示例中将&的参数alignat设置为。)2

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath} % for 'alignat' environment
\begin{document}
\begin{alignat}{2}
     0.9 &\leq \ a_t,d_t &&\leq 1.1 \label{zoom} \\
    -0.1 &\leq \ b_t,c_t &&\leq 0.1 \label{rotation} \\
    -0.05&\leq b_t + c_t &&\leq 0.05\label{limit_skew}\\
    -0.1 &\leq a_t - d_t &&\leq 0.1 \label{non_uniform_scale}   
\end{alignat}
\end{document}

相关内容