%------------------------------------------------------------------------------------ %
\documentclass[english]{book}
%------------------------------------------------------------------------------------ %
%
\usepackage[fleqn]{amsmath} %
\usepackage{amsthm,amssymb} %
\usepackage{tikz} % tikz - essential
\usepackage[T1]{fontenc} %
\usepackage{newtxtext} %
\usepackage{newtxmath} %
\usepackage{xcolor} %
\usepackage{colortbl} % changed to just colortbl
\usepackage[paperwidth=170mm,paperheight=240mm,textwidth=132mm,lmargin=12.5mm,rmargin=12.5mm,bindingoffset=12.5mm,noheadfoot,nomarginpar,showframe,showcrop]{geometry} %
\usepackage[a4,frame,cam,center]{crop}
\usepackage{setspace}
%
% --------------------------------------- START DECLARATIONS --------------------------- %
%
\setlength{\unitlength}{1mm} % 1mm=2.834646pt; 1pt=0.3515mm
\setlength{\parskip}{6pt}
\newenvironment{eq}[2]{ %
\setlength{\mathindent}{#1}%
\setlength{\hsize}{\dimexpr\hsize-#2\relax} %
\ignorespaces
}{\ignorespacesafterend}
\renewcommand{\theequation}{\hspace{1.0pt}\thechapter\hspace{0.7pt}.\hspace{0.7pt}\arabic{equation}\hspace{0.8pt}}
\begin{document}
\setstretch{1.00}
\noindent Using the latest 64-bit versions of Technic Center and MiKTeX 2.9\hspace{2.2pt}\ldots
\noindent How can I automatically generate the sequences of dashes within the equations so that \\ they line up perfectly left-to-right.
\vspace{-12pt}
\begin{eq}{124pt}{18pt}
\begin{equation}
\text{\hspace{2pt}}l\hspace{-0.4pt}+\hspace{-0.4pt}m\hspace{-0.4pt}=\hspace{-0.4pt}m\hspace{-0.4pt}+\hspace{-0.4pt}l\text{\hspace{12pt}-\hspace{6pt}manually developed spaces \hspace{8pt}-\hspace{10pt}} \label{eqn:chap_intro_to_num_02}
\end{equation}
\end{eq}
\vspace{-12pt}
\begin{eq}{106pt}{18pt}
\begin{equation}
\text{\hspace{2pt}}(\hspace{1.0pt}l\hspace{-0.4pt}+\hspace{-0.4pt}m\hspace{-0.4pt})\hspace{-0.4pt}+\hspace{-0.4pt}n\hspace{-0.4pt}=\hspace{-0.4pt}l+\hspace{-0.4pt}(\hspace{0.4pt}m\hspace{-0.4pt}+\hspace{-0.4pt}n\hspace{0.8pt})\text{\hspace{24pt}-\hspace{22pt}-\hspace{22pt}-\hspace{22pt}-\hspace{22pt}-\hspace{12pt}} \label{eqn:chap_intro_to_num_04}
\end{equation}
\end{eq}
\vspace{-12pt}
\begin{eq}{78pt}{18pt}
\begin{equation}
x\hspace{0.6pt}+\hspace{0.6pt}x\hspace{0.6pt}+\hspace{0.6pt}x\hspace{0.6pt}+\hspace{0.6pt}x\hspace{0.6pt}+\hspace{0.6pt}x\hspace{0.6pt}+\hspace{0.6pt}x\hspace{0.6pt}+\hspace{0.6pt}x\hspace{0.6pt}+\hspace{0.6pt}x\hspace{0.6pt}+\hspace{0.6pt}x\hspace{0.6pt}+\hspace{0.6pt}x=12x\text{\hspace{14pt}-\hspace{22pt}-\hspace{22pt}-\hspace{22pt}-\hspace{12pt}} \label{eqn:chap_intro_to_num_06}
\end{equation}
\end{eq}
\end{document}
答案1
如果我正确理解了这个问题,您可以使用\leaders
您可以使用\dotfill
但使用点,但使用破折号很容易做出类似的命令。
\documentclass[english]{book}
%------------------------------------------------------------------------------------ %
%
\usepackage[fleqn]{amsmath} %
\usepackage{amsthm,amssymb} %
\usepackage{tikz} % tikz - essential
\usepackage[T1]{fontenc} %
\usepackage{newtxtext} %
\usepackage{newtxmath} %
\usepackage{xcolor} %
\usepackage{colortbl} % changed to just colortbl
\usepackage[paperwidth=170mm,paperheight=240mm,textwidth=132mm,lmargin=12.5mm,rmargin=12.5mm,bindingoffset=12.5mm,noheadfoot,nomarginpar,showframe,showcrop]{geometry} %
\usepackage[a4,frame,cam,center]{crop}
\usepackage{setspace}
%
% --------------------------------------- START DECLARATIONS --------------------------- %
%
\setlength{\unitlength}{1mm} % 1mm=2.834646pt; 1pt=0.3515mm
\setlength{\parskip}{6pt}
\setlength\parindent{0pt}
\newenvironment{eq}[2]{%
\setlength{\mathindent}{#1}%
\setlength{\hsize}{\dimexpr\hsize-#2\relax}%
\ignorespaces
}{\ignorespacesafterend}
\renewcommand{\theequation}{\thechapter.\arabic{equation}}
\newcommand\dashfill{\leaders\hbox to 1em{\hss--\hss}\hskip\fill\kern0pt\relax}
\begin{document}
Using the latest 64-bit versions of Technic Center and MiKTeX 2.9\hspace{2.2pt}\ldots
How can I automatically generate the sequences of dashes within the equations so that \\ they line up perfectly left-to-right.
\begin{eq}{124pt}{18pt}
\begin{equation}
l+m=m+l \dashfill \label{eqn:chap_intro_to_num_02}
\end{equation}
\end{eq}
\begin{eq}{106pt}{18pt}
\begin{equation}
(l+m)+n=l+(m+n)\dashfill \label{eqn:chap_intro_to_num_04}
\end{equation}
\end{eq}
\begin{eq}{78pt}{18pt}
\begin{equation}
x+x+x+x+x+x+x+x+x+x=12x\dashfill \label{eqn:chap_intro_to_num_06}
\end{equation}
\end{eq}
\end{document}