Generaltag & align command

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
User avatar
0.8.15
Posts: 16
Joined: Mon May 26, 2008 10:39 am

tag & align command

Post by 0.8.15 »

first of all i have problems with the "tag" command. it does not nummerise the equations automatically.
the second thing is, that the equations sould be "alinged" in reference of the first equal sign (=).

now i am coding to days and nothing helps. :oops:

Code: Select all

\documentclass[12pt,a4paper,headsepline]{article}
\usepackage{onlyamsmath}
%\usepackage{gnuplot}%plotting math.graphs
%\usepackage{amsdsy}
%\usepackage{amstex}
%\usepackage{amsopn}
%\usepackage{amsfonts}
%\usepackage{amsgen}
%\usepackage{amssymb}% to separate formulas from text
%\usepackage{amsmath}% spacing in math formulas
%\usepackage{latexsym}
%\usepackage{tabularx}%all colums are having the same with. it requires the "array" package.
\usepackage{array}
\usepackage[english]{babel}
%\usepackage{float}

\begin{document}

\vspace{0.5cm} 
\begin{math}
\begin{equation}
\tag{\label{E:Fr}}%should nummerise equations automaticaly!!!!!!!!!!! but how????????
%\tag{[color=#FF0000]1[/color]}
%\begin{align}
%\[
%\begin{split}
\vspace{0.2cm} 
\begin{center}
\quad $F_R$\quad\le\quad $\mu_H$ \textperiodcentered\, $F_N$ \\ 
\end{center}
%\end{align}
%\end{quote}    
\end{equation}
%\end{split}                             
%\end{math}
\intertext{\textbf{The Dynamic-Friction:}}
\intertext{\begin{quote}
If the dynamic-friction is greater than the adhesion-friction the medium gets in to movement. The friction is then defined according to the Coulomb\textquoteright s law.
\end{quote}}
%\vspace{0.5cm} 
%\begin{math}
\begin{equation}
\tag{\label{E:Fr1}} 
%\tag{[color=#FF0000]2[/color]}
%\begin{align}
%\begin{split}
\vspace{-0.4cm}  
\begin{center}
$F_R$\quad =\quad $\mu$ \textperiodcentered\, $F_N$ \\ 
\end{center}
%\end{align}
\end{equation}
%\end{math}
%\end{split}
\intertext{The friction on $compound_1$ is defined accordingly:}
%\vspace{0.6cm} 
%\begin{math}
%\begin{align}
\begin{equation}
\tag{\ref{E:Fr1}a}
%\tag{[color=#FF0000]2a[/color]}
\begin{center}
{$\overrightarrow{{F}_R_1}$}
\quad =\quad - $\mu_R$ \left|\overrightarrow{$F_N$}\right| \frac{\overrightarrow{$v_r_e_l$}}{\left|\overrightarrow{$v_r_e_l}\right|} \\ 
%\label{E:Fr1}
\end{center}
%\end{align}
%\end{math}
\end{equation}
%\vspace{0.6cm}  
\\
\intertext{$F_R_2$ on $compound_2$ is:}
\vspace{0.5cm} 
%\begin{math}
%\begin{align}
\begin{equation}
\tag{\ref{E:Fr1}b}
%\tag{[color=#FF0000]2b[/color]}
\begin{center}
\qquad\qquad\quad {$\overrightarrow{{F}_R_2}$}\quad =\quad - {$\overrightarrow{{F}_R_1}$}\quad=\quad - $\mu_R$ \left|\overrightarrow{$F_N$} \right|
\frac{\overrightarrow{$v_r_e_l$}}{\left|\overrightarrow{$v_r_e_l}\right|} \\  
%\label{E:Fr1}
\end{center}   
%\end{split}
%\]
%\end{align}
\end{equation}
%\end{math}                           
 %\vspace{0.6cm}
\\  
text text text text....

\newpage
{$F_m_a_x$} can be calculated by addition of the individual vectors:
\vspace{1.5cm}
%\begin{math}
\begin{equation}
\tag{\label{E:Fmax}}   %\tag{3}
%\begin{center}
\qquad $F_m_a_x$\quad = \quad 
\overrightarrow{F}_N$ \quad + \quad \overrightarrow{F}_R$     \\
%\end{center}
\end{equation}
\begin{equation}
\tag{\ref{E:Fmax}a}   %\tag{3a}
\begin{center}
\qquad\qquad\qquad = \quad 
\left($F_N_1$ + $F_R_1$ )\right\overrightarrow{i} +
\left($F_N_2$ + $F_R_2$ )\right\overrightarrow{j} +
\left($F_N_3$ + $F_R_3$ )\right\overrightarrow{k}     \\   
\end{center}
\end{equation}
%\vspace{0.5cm}
\begin{math}
\begin{equation}
\tag{\ref{E:Fmax}b}   %\tag{3b}
%\begin{center}
\qquad\qquad\qquad\;\:\, = \quad \sum_{i,j,k=1}^{n} \quad
\left(
\begin{matrix}
$F_N_1$ + $F_R_1$ \\
$F_N_2$ + $F_R_2$ \\
$F_N_3$ + $F_R_3$ \\
\end{matrix}
\right)                                                 \\
%\end{center}
\vspace{1.5cm}
\end{equation}
%\end{math}
%\end{align}
\end{math}

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

tag & align command

Post by Stefan Kottwitz »

Hi,

have a look at the amsmath user's guide, it explains numbering and alignment.
For alignment use the align environment. equations and aligned math environments will be automatically numbered. You could use \label and \ref if you need cross references. \tag allows to use different tags like (*), (**) or [A] etc. If you just need (1), (2), ... you don't need \tag.

Stefan
LaTeX.org admin
User avatar
0.8.15
Posts: 16
Joined: Mon May 26, 2008 10:39 am

Re: tag & align command

Post by 0.8.15 »

i am using the book "math into latex" from grätzer.
my problem ist that i need to nummerize the formulars like:

1
2
2a
2b
3
3a
3b

and i am having text within. thanks for your link to "amsldoc". but i guess i am having here a more complex problem. (align) is no problem anymore.
i tryed to turn off the countings with (align*) and use the (tag) or (subequations) command - nothing helped - instead of 2 it shows 2a
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

tag & align command

Post by localghost »

This not really a more complex problem. You have to use the subequations environment from amsmath and decrease the equation counter at the right place. Take this as an example.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{txfonts}
\usepackage{blindtext}

\parindent0em

\begin{document}
  \begin{equation}\label{eqn:einstein}
    E=mc^2
  \end{equation}
  \addtocounter{equation}{-1}
  \begin{subequations}  %\label{eqn:binomi}   % label for whole equation system does not really work in this case because of preceding line
    \begin{align}
      (a+b)^2&=a^2+2ab+b^2 \label{subeqn-1:binomi} \\
      \intertext{Some text in between}
      (a-b)^2&=a^2-2ab+b^2 \label{subeqn-2:binomi} \\
      (a+b)(a-b)&=a^2-b^2 \label{subeqn-3:binomi}
    \end{align}
  \end{subequations}
\end{document}
The right positioning of labels gives you access to the whole equation system (see remark in code) or single equations of that system. Just try to refer to the labels in your text and see the result. Some usefuls hints for typesetting complex mathematical expressions are given in "Math mode".


Best regards
Thorsten¹
User avatar
0.8.15
Posts: 16
Joined: Mon May 26, 2008 10:39 am

tag & align command

Post by 0.8.15 »

your example wors very well. thank you.

but still.... i can not display 2a and 2b in my case. also these equations in (subequations) can not be displayed.

oh wait...i guess i have to implement the package "esvec" or "esvect17".

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{txfonts}
\usepackage{blindtext}
\numberwithin{equation}{section}
\parindent0em

\begin{document}
\section{dd}
dddddddddddd
\subsection{ff}
ffffffffffff

\begin{equation}
    \label{eqn:Fr1}
$F_R$\quad & \leq \quad $\mu_H$ \textperiodcentered\, $F_N$ 
\end{equation}

\begin{equation}
\label{eqn:Fr2}
$F_R$\quad & = \quad $\mu$ \textperiodcentered\, $F_N$ 
\end{equation}
\addtocounter{equation}{-1}
\begin{subequations}
\label{eqn:Fr2}
\begin{align}
{$\overrightarrow{{F}_R_1}$} \quad & =\quad - $\mu_R$ \left|\overrightarrow{$F_N$}\right| \frac{\overrightarrow{$v_r_e_l$}}{\left|\overrightarrow{$v_r_e_l}\right|} \\ 
\label{subeqn-1:Fr2}
{$\overrightarrow{{F}_R_2}$} \quad & =\quad - {$\overrightarrow{{F}_R_1}$}\quad    =\quad - $\mu_R$ \left|\overrightarrow{$F_N$} \right|
\frac{\overrightarrow{$v_r_e_l$}}{\left|\overrightarrow{$v_r_e_l}\right|}   
\label{subeqn-2:Fr2}
\end{align}
\end{subequations}                  
\end{document}
Last edited by 0.8.15 on Wed Sep 10, 2008 4:22 pm, edited 1 time in total.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

tag & align command

Post by localghost »

First of all I must admit that I was a little bit astonished about your way of coding. Moreover I was not able to compile your code example because I got many errors. So I may venture some enhancements.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage[centering,includeheadfoot,margin=2cm]{geometry}
\usepackage{amsmath}
\usepackage{txfonts}

\parindent0em

% New commands and setups for mathematical expressions (amsmath)
\newcommand{\abs}[1]{\lvert#1\rvert}
\newcommand{\norm}[1]{\lVert#1\rVert}
\numberwithin{equation}{section}

\begin{document}
  \begin{equation}\label{E:Fr}
    F_R\leq\mu_H\cdot F_N
  \end{equation}

  \begin{equation}\label{E:Fr1}
    F_R=\mu\cdot F_N
  \end{equation}

  \addtocounter{equation}{-1}
  \begin{subequations}\label{eqn:Fr1}
    \begin{alignat}{2}
      \vec{F}_{R_1}&= -\mu_R \abs{\vec{F}_N}\frac{\vec{v}_\text{rel}}{\abs{\vec{v}_\text{rel}}} \label{subeqn-1:Fr1} \\
      \vec{F}_{R_2}&= -\vec{F}_{R_1}&=-\mu_R\abs{\vec{F}_N}\frac{\vec{v}_\text{rel}}{\abs{\vec{v}_\text{rel}}} \label{subeqn-2:Fr1}
    \end{alignat}
  \end{subequations}
\end{document}
Note that I declared some new commands in the preamble to make life easier. Moreover I used the alignat environment instead of the simple align environment. Some useful hints about typesetting mathematical expressions can be found in "Math mode"
User avatar
0.8.15
Posts: 16
Joined: Mon May 26, 2008 10:39 am

Re: tag & align command

Post by 0.8.15 »

many, many thanks for your help. i know now that "$" in euations needs to be avoid !!!
Post Reply