Align* environment inside tabbing environment?

  • MHB
  • Thread starter Ackbach
  • Start date
In summary: I figured it out. The tabbing environment helps to break up the long line so that the alignat* environment can work.In summary, the tabbing environment helps to break up the long line so that the alignat* environment can work.
  • #1
Ackbach
Gold Member
MHB
4,155
93
Why doesn't this code work?

Code:
\begin{tabbing}\qquad \= 11.\quad \= 
\kill

\>1.\>
\begin{align*}
f(x)&=2x+4\\
a&=3\\
\end{align*}
\\
\end{tabbing}

Is it not allowed to put an align* environment inside a tabbing environment?
 
Physics news on Phys.org
  • #2
Ackbach said:
Why doesn't this code work?

Code:
\begin{tabbing}\qquad \= 11.\quad \= 
\kill

\>1.\>
\begin{align*}
f(x)&=2x+4\\
a&=3\\
\end{align*}
\\
\end{tabbing}

Is it not allowed to put an align* environment inside a tabbing environment?
Have you tried \alignat* ?
 
  • #3
\begin{tabbing}\qquad \= 11.\quad \=
\kill

\>1.\>
\begin{alignat*}{1}
f(x)&=2x+4\\
a&=3\\
\end{alignat*}
\\
\end{tabbing}

The alignat* environment didn't work any better than align*, so far as I can see.
 
  • #4
Here is a quote from the User's Guide for the amsmath Package.

Like equation, the multi-equation environments gather, align, and alignat are designed to produce a structure whose width is the full line width. This means, for example, that one cannot readily add parentheses around the entire structure. But variants gathered, aligned, and alignedat are provided whose total width is the actual width of the contents; thus they can be used as a component in a containing expression.

In my test, the environment aligned worked.
 
  • #5
Evgeny.Makarov said:
Here is a quote from the User's Guide for the amsmath Package.
Like equation, the multi-equation environments gather, align, and alignat are designed to produce a structure whose width is the full line width. This means, for example, that one cannot readily add parentheses around the entire structure. But variants gathered, aligned, and alignedat are provided whose total width is the actual width of the contents; thus they can be used as a component in a containing expression.
In my test, the environment aligned worked.

Wonderful! The quote you so helpfully posted helps me understand why it doesn't work, as well as showing me why the substitute environment does. Fantastic. I'll give it a try when I have some time.
 
  • #6
Worked just fine. Had to tweak it a hair to get the alignment what I wanted. Final working code:

Code:
\begin{tabbing}\qquad \= 11.\quad \= \hpsace{0.4\linewidth} \= 11.\quad \=
\kill

\>$\phantom{1}$1.\>
$\begin{aligned}[t]
f(x)&=2x+4\\
a&=3\\
L&=10\\
\varepsilon&=0.01
\end{aligned}$
\>$\phantom{1}$5.\>
$\begin{aligned}[t]
f(x)&=6x-10\\
a&=-2\\
L&=-22\\
\varepsilon&=0.4
\end{aligned}$\\
\end{tabbing}

Thanks much!
 

FAQ: Align* environment inside tabbing environment?

What is the purpose of using the align* environment inside the tabbing environment?

The align* environment is used to align equations or formulas in a specific way, while the tabbing environment is used to create tabular structures. By combining these two environments, you can align multiple equations or formulas within a tabular layout.

How do you use the align* environment inside the tabbing environment?

To use the align* environment inside the tabbing environment, you first need to load the amsmath package in your document's preamble. Then, within the tabbing environment, you can use the \begin{align*} and \end{align*} commands to start and end the align* environment, respectively. Within these commands, you can use the & symbol to specify the alignment points for each equation or formula.

Can you nest align* environments inside the tabbing environment?

Yes, you can nest align* environments inside the tabbing environment. This can be useful when you need to align equations or formulas in multiple columns within a tabular structure.

How do you align equations or formulas in multiple columns using the align* environment inside the tabbing environment?

To align equations or formulas in multiple columns, you can use the & symbol to specify the alignment points for each column. For example, if you want to align equations in two columns, you can use the & symbol twice within the align* environment command, and then use the \\ command to move to the next row.

Are there any limitations to using the align* environment inside the tabbing environment?

One limitation of using the align* environment inside the tabbing environment is that it cannot be used within a table or array environment. Additionally, the align* environment must be used within a math mode environment, such as \begin{equation*} and \end{equation*}. Lastly, the tabbing environment does not allow for automatic line breaking, so you may need to manually adjust the spacing or use the \kill command to prevent unwanted line breaks.

Similar threads

Replies
6
Views
4K
Replies
1
Views
6K
Replies
8
Views
3K
Replies
3
Views
1K
Back
Top