TransWikia.com

How to automatically generate linking dashes to labels in math equations

TeX - LaTeX Asked by keith77777 on April 7, 2021

enter image description here

%------------------------------------------------------------------------------------ %
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}{dimexprhsize-#2relax} %
  ignorespaces
}{ignorespacesafterend}

renewcommand{theequation}{hspace{1.0pt}thechapterhspace{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.9hspace{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}}lhspace{-0.4pt}+hspace{-0.4pt}mhspace{-0.4pt}=hspace{-0.4pt}mhspace{-0.4pt}+hspace{-0.4pt}ltext{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}lhspace{-0.4pt}+hspace{-0.4pt}mhspace{-0.4pt})hspace{-0.4pt}+hspace{-0.4pt}nhspace{-0.4pt}=hspace{-0.4pt}l+hspace{-0.4pt}(hspace{0.4pt}mhspace{-0.4pt}+hspace{-0.4pt}nhspace{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}
xhspace{0.6pt}+hspace{0.6pt}xhspace{0.6pt}+hspace{0.6pt}xhspace{0.6pt}+hspace{0.6pt}xhspace{0.6pt}+hspace{0.6pt}xhspace{0.6pt}+hspace{0.6pt}xhspace{0.6pt}+hspace{0.6pt}xhspace{0.6pt}+hspace{0.6pt}xhspace{0.6pt}+hspace{0.6pt}xhspace{0.6pt}+hspace{0.6pt}x=12xtext{hspace{14pt}-hspace{22pt}-hspace{22pt}-hspace{22pt}-hspace{12pt}} label{eqn:chap_intro_to_num_06}
end{equation}
end{eq}

end{document}

One Answer

If I understand the question correctly you can use leaders You could use dotfill but that uses dots, but it is easy to make a similar command using a dash.

enter image description here

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}
setlengthparindent{0pt}

newenvironment{eq}[2]{%
  setlength{mathindent}{#1}%
  setlength{hsize}{dimexprhsize-#2relax}%
  ignorespaces
}{ignorespacesafterend}

renewcommand{theequation}{thechapter.arabic{equation}}

newcommanddashfill{leadershbox to 1em{hss--hss}hskipfillkern0ptrelax}
begin{document}


Using the latest 64-bit versions of Technic Center and MiKTeX 2.9hspace{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=12xdashfill label{eqn:chap_intro_to_num_06}
end{equation}
end{eq}

end{document}

Correct answer by David Carlisle on April 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP