LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-21-2016, 07:29 PM   #1
andrew.comly
Member
 
Registered: Dec 2012
Distribution: Trisquel-Mini 7.0, Lubuntu 14.04, Debian lxde 8.0
Posts: 311
Blog Entries: 2

Rep: Reputation: 16
Question LaTeX: Why are tags missing in alignment sublevels?


LaTeX Question
I would like to have integer tags all the way on the right hand side of each equation line.
I also need multiple alignment(horizontal) levels.

Attempt 01: Michelle Krummel's Lists tutorial '
Code:
	\begin{enumerate}  
	\item  
		\begin{align}  
			\frac{d}{dx}[f(x)]  
		\end{align}  
	\item  
		\begin{align}  
			\frac{d}{dx}[g(x)]  
		\end{align}  
	\item  
		\begin{itemize}  
			\item  
				\begin{align}  
					\frac{d}{dx}[h(x)]  
				\end{align}  
				\item  
				\begin{itemize}  
					\item  
						\begin{itemize}  
							\item  
								\begin{align}  
									\frac{d}{dx}[A(x)]  
								\end{align}  
							\item  
								\begin{align}  
									\frac{d}{dx}[H(x)]  
								\end{align}  
						\end{itemize}  
				\end{itemize}  
	\end{itemize}  
	\end{enumerate}
This way does produce an effect very close to what I want to do, except for the list numbering, bulleting, "dash", and "star" on the left hand side. This is a result of \begin{enumerate} and \end{enumerate}, but without it the \item trick just doesn't work. '
However, I find having to write the following clauses for each successive indentation a tad bit onerous:
Code:
		\begin{enumerate}
			\item 
				\begin{itemize}
					...
				\end{itemize}
		\end{enumerate}
The next two attempts I use: http://tex.stackexchange.com/questio...gn-environment
On this page there are two solutions: 2) Steven B. Segletes and 3) David Carlisle

Attempt 02: Segletes
Code:
	\documentclass[12pt,a4paper]{article}
	\usepackage[fleqn]{amsmath}
	\usepackage[utf8]{inputenc}
	\usepackage{amsmath}
	\usepackage{mathtools}
	\usepackage{amsfonts}
	\usepackage{amssymb}
	\usepackage{makeidx}
	\usepackage{parskip}
	\usepackage{graphicx}
	\usepackage{lmodern}
	\usepackage{verbatim}
	\usepackage[usestackEOL]{stackengine}
	\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
	\author{Andrew}
	\stackMath
	\begin{document}
		Proove Theorem AAC
			\begin{align}
				\mbox{Let y } & = \Longunderstack[l] {
					f(x)		\\
					g(x)	
					}			\\
						x & = \Longunderstack[l] {
						h(x)		\\
						%w & = \Longunderstack[l] {
						%	A(x)		\\
						%	}	
						}
			\end{align}
		\end{document}
This works well for two levels of alignment, but notice how above I had to comment out the third level of alignment. You can't use the \Longunderstack[l] within another \Longunderstack, thus only two levels of alignment. '


Attempt 03: David Carlisle
Code:
	\documentclass[12pt,a4paper]{article}
	\usepackage[fleqn]{amsmath}
	\usepackage[utf8]{inputenc}
	\usepackage{amsmath}
	\usepackage{mathtools}
	\usepackage{amsfonts}
	\usepackage{amssymb}
	\usepackage{makeidx}
	\usepackage{parskip}
	\usepackage{graphicx}
	\usepackage{lmodern}
	\usepackage{verbatim}
	\usepackage[usestackEOL]{stackengine}
	\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
	\author{Andrew}
	\stackMath
	\begin{document}
		\begin{align}
			Carlisle &				\\					
				 &Sample Explanation		\\	 
					\nu(u_1)&= f(x)										\\  %Alignment Level 1
									&= \cosh(x) - \sinh(x)		\\	%Alignment Level 1
									& G(x) =
				\!\begin{aligned}[t]
						& A(x)				\\								%Alignment Level 2
						& H(x) = \int^Q_O z(x) dx	\\		%Alignment Level 2
						& L(x) =												%Alignment Level 2 
						\!\begin{aligned}[t]
							& \frac{d}{dx} P(x)						\\			%Alignment Level 3 
							& S(x)																%Alignment Level 3
						\end{aligned}
					\end{aligned}
			\end{align}
	\end{document}
Carlisle's method better matches my purpose than Segletes' method because you can utilize "\!\begin{aligned}[t]" recursively, thus it seems that there is no limitation on the number of alignment levels. '

But where did the TAGS go? Vanished!? I am in dire need for them.

Last edited by andrew.comly; 11-21-2016 at 07:33 PM. Reason: clarity
 
Old 11-24-2016, 02:27 AM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196
Hi Andrew!

I am not a LaTeX guru, but as no one else has volunteered I will offer what little help that I can.

I did work through your examples, and spent some useful time with variations of the Carlisle version.

I have modified your Carlisle code as follows, to simplify the essentials of your problem...

Code:
\documentclass[12pt,a4paper]{article}
\usepackage[fleqn]{amsmath}
\begin{document}
        \begin{align}
                Carlisle & \notag\\
                         &Sample Explanation \notag\\
                                \nu(u_1)&= f(x) \\ %Alignment Level 1
                                        &= \cosh(x) - \sinh(x) \\ %Alignment Level 1
                                        & G(x) =
                                \begin{aligned}[t]
                                        & A(x) \\ %Alignment Level 2
                                        & H(x) = \int^Q_O z(x) dx \\ %Alignment Level 2
                                        & L(x) = %Alignment Level 2
                                        \begin{aligned}[t]
                                                & \frac{d}{dx} P(x) \\ %Alignment Level 3
                                                & S(x) %Alignment Level 3
                                        \end{aligned}
                                \end{aligned}
        \end{align}
\end{document}
If I understand correctly, you are wondering where the equation numbering for H(x) and L(x) have "vanished" to.

When you use the aligned environment to group those lines you are telling it to use a single equation number for the group - which is what you see as (3).

I do not have a complete answer worked out, but I would suggest looking at the split sub-environment instead of nested aligns where they apply, and maybe use of \phantom{...} and \qquad for fine control of indent levels. Also, careful placement of the alignment marks (&'s) can allow some easy and useful positioning of trailing lines.

In refreshing my own LaTeX knowledge I found this LaTeX tips: Displayed Math page which is a fairly basic but good reference.

And of course, the definitive introduction, The Not So Short Introduction to LaTeX2e by Tobi Oetiker. Not so short, but not so long either, and required reading for new LaTeX users!

Hope this provides some useful help!

Last edited by astrogeek; 11-24-2016 at 11:17 PM. Reason: Added link
 
1 members found this post helpful.
Old 11-30-2016, 10:00 PM   #3
andrew.comly
Member
 
Registered: Dec 2012
Distribution: Trisquel-Mini 7.0, Lubuntu 14.04, Debian lxde 8.0
Posts: 311

Original Poster
Blog Entries: 2

Rep: Reputation: 16
Wink [SOLVED] alignat & \mathrlap

The answer comes down to using alignat{2} instead of align. In case you experience any extra width, you may use \mathrlap{}, e.g.
Code:
\begin{document} 
  \begin{alignat}{3}
    Carlisle & \notag\\
    &Sample Explination             \\                  
        \nu(u_1)&= f(x)   \\
                &= \mathrlap{\cosh(x) - \sinh(x) }     \\
                & G(x) =& A(x) &\\ %Alignment Level 2           
                &       & H(x) &= \mathrlap{\int^Q_O z(x) dx }   \\
                &       & L(x) %Alignment Level 2
	\end{alignat}
\end{document}
I found the answer on latex-community.org. Anyone else with the same problem who is interested in reading more about this can find the following discussions sites highly beneficial:
http://latex-community.org/forum/vie...alignat#p75832
http://latex-community.org/forum/vie...alignat#p75834
http://latex-community.org/forum/vie...alignat#p75798
http://latex-community.org/forum/vie...alignat#p76177

For more indentation levels some people like adjusting the integer in \alignat{2} to a higher number, e.g. \alignat{3}

Last edited by andrew.comly; 11-30-2016 at 10:51 PM. Reason: clarity
 
1 members found this post helpful.
Old 12-01-2016, 02:13 AM   #4
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196
Excellent! Glad that you figured it out!

And thanks for posting your solution code and links for others to benefit from!

The simplicity of this solution says it is the "right" one!
 
1 members found this post helpful.
Old 12-10-2016, 10:11 PM   #5
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196
Participating in this thread recently rekindled my interest in LaTeX (which I have not used much in a very long time). I tend to do most of my typeset document preparation with LyX these days and only encounter LaTeX markup directly with a few snippets of ERT* as needed.

Today, while looking for new resources I ran across this site which provides a really excellent collection of links and downloadable guides and other resources for the math LaTeX user. I thought it was worth sharing!

*Evil red text, aka latex markup
 
1 members found this post helpful.
  


Reply

Tags
latex, tags



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] mp3 tags inconsistency between Linux and Sansa Fuze (mp3 tags editing software?) Hungry ghost Linux - Software 3 12-17-2012 08:09 PM
[SOLVED] Alignment of a file vikas027 Programming 4 04-23-2009 06:36 AM
Alignment of text in C pritchardtom Programming 3 11-21-2005 04:06 PM
After Editing Tags with JuK - XMMS do not display tags correctly Artik Linux - Software 0 07-23-2005 05:55 AM
about alignment eshwar_ind Programming 5 10-18-2004 08:27 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration