使用以下代码:
\documentclass[a4paper, 11pt]{article}
\usepackage[top=3cm, bottom=3cm, left=3cm, right=3cm]{geometry}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}anglosajones
\usepackage[none]{hyphenat}
\usepackage{float}
\usepackage{changepage}
\usepackage{booktabs}
\usepackage{pgfplots}
\usepackage{layouts}
\usepackage{caption}
\usepackage{lscape}
\usepackage{rotating}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{listings}
\begin{document}
\begin{align*}
Y_{1t}& + \beta_{12}Y_{2t}& + \gamma_{11} &+ \gamma_{12}X_{2t}& &+ \gamma_{14}X_{4t} = \mu_{1t}\\ \beta_{21}Y_{1t}& + Y_{2t}& + \gamma_{21} & &+ \gamma_{23}X_{3t} &+ \gamma_{24}X_{4t} = \mu_{2t}
\end{align*}
\end{document}
有谁能帮我吗?我想减少术语之间的间距。我花了很多时间尝试,但没有成功
答案1
你可以使用alignat
,但使用 更简单array
。无论如何,我将展示这两种方法
我array
定义了 15 列,右对齐的列与居中的列交替,两端都有空原子用于操作或关系符号。
语法alignat*
类似,但有一些细微的点需要考虑。
\documentclass[a4paper, 11pt]{article}
\usepackage{amsmath}
\usepackage{array}
\begin{document}
\begin{equation*}
\setlength{\arraycolsep}{0pt}% let TeX use the right spacing
\begin{array}{
r
*{7}{>{{}}c<{{}}r}
}
Y_{1t} &+& \beta_{12}Y_{2t} &+& \gamma_{11} &+& \gamma_{12}X_{2t} && &+& \gamma_{14}X_{4t} &=& \mu_{1t}
\\[1ex]
\beta_{21}Y_{1t} &+& Y_{2t} &+& \gamma_{21} && &+& \gamma_{23}X_{3t} &+& \gamma_{24}X_{4t} &=& \mu_{2t}
\end{array}
\end{equation*}
\begin{alignat*}{7}
Y_{1t} &+{}& \beta_{12}Y_{2t} &+{}& \gamma_{11} &+{}& \gamma_{12}X_{2t} && &+{}& \gamma_{14}X_{4t} &= \mu_{1t}
\\
\beta_{21}Y_{1t} &+{}& Y_{2t} &+{}& \gamma_{21} && &+{}& \gamma_{23}X_{3t} &+{}& \gamma_{24}X_{4t} &= \mu_{2t}
\end{alignat*}
\end{document}
答案2
解决方案是。请注意,加载 时alignat*
无需加载,因为后者会为您完成此操作。amsmath
mathtools
\documentclass[a4paper, 11pt]{article}
\usepackage[top=3cm, bottom=3cm, left=3cm, right=3cm]{geometry}
\usepackage[spanish]{babel}
\usepackage[none]{hyphenat}
\usepackage{float}
\usepackage{changepage}
\usepackage{booktabs}
\usepackage{pgfplots}
\usepackage{layouts}
\usepackage{caption}
\usepackage{lscape}
\usepackage{rotating}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{listings}
\begin{document}
\begin{alignat*}{5}
Y_{1t}& + \beta_{12}Y_{2t} & & + \gamma_{11} & & + \gamma_{12}X_{2t}& & &{} + \gamma_{14}X_{4t} & = \mu_{1t}\\
\beta_{21}Y_{1t} &+ Y_{2t}& & + \gamma_{21} & & & & +\gamma_{23}X_{3t} &{}+ \gamma_{24}X_{4t} & = \mu_{2t}
\end{alignat*}
\end{document}