tags:

views:

1204

answers:

2

I'm trying to learn LaTeX, currently because otherwise, my professors will be nearly unable to read my homework assignments. I've come across something I want to do, but don't seem to be able to, ie. I have searched google (possibly with a poor keyword set) and not found a solution.

The specific case is as follows: I want to put an ams flalign environment inside a box and have multiple such environments side by side. I have achieved this using minipage, but minipage asks for a width. I would like to use the smallest width in which the flalign environment fits. I realize that I can set the width to 0pt, but I can't help wondering if there's something that is intended to do this.

Also, should I be using minipage? Is there another command I don't know?

Thanks for your reply.

EDIT:

An attempted clarification as to what I want to do. I want equations which are standard, known, given, etc. and short on the left. To the right of those, I want relevant derived equations (and maybe their derivations. Further right, I want actual calculations plugged in.

I feel like what I want is a tabular environment with 3 columns, but I don't think I can put an equation environment in a tabular environment.

This looks like what I want when I render it.

\begin{minipage}[t]{0pt}
\begin{flalign*}
\sigma & = F / A&\\
A & = \pi \left(d/2\right)^2&\\
\epsilon &= \frac{\sigma}{E}&\\
\epsilon_{trans} &= - \nu \epsilon_{longi}& \\
\epsilon &= \frac{\Delta l}{l}&\\
l &= \left( \epsilon + 1 \right) \times l_0&
\end{flalign*}
\end{minipage}
\hspace*{0pt}
\begin{minipage}[t]{0pt}
\begin{flalign*}
d & = \unit[1.8]{mm} = \unit[1.8\e{-3}]{m} &\\
F_T & = \unit[1300]{N}&\\
E_{\text{stainless steel}}&=\unit[193\e9]{Pa}&\\
l_0 & = \unit[.2530]{m}&\\
\nu & = .33&\\
\sigma &= \frac{\unit[1300]{N}}{\pi \times \unit[3.24\e{-6}]{m^2}}&&= \boxed{\unit[127.7\e6]{Pa}}\\
&&&=\boxed{\unit[18,524]{psi}}\\
\epsilon &= \frac{\unit[127.7\e6]{Pa}}{\unit[193\e9]{Pa}} &&= \boxed{6.6\e{-2}}\\
\epsilon_{trans} &= -.33 \times 6.6\e{-2} &&=\boxed{-2.2\e{-2}}\\
l &= \left( 6.6\e{-2} + 1 \right) \times \unit[.2530]{m} &&= \boxed{\unit[.2797]{m}}
\end{flalign*}
\end{minipage}
A: 

You might find something to help you in the empheq and mathtools packages. empheq allows you to box equations and mathtools should provide some useful environments for stacking them horizontally.

Will Robertson
Looking through the empheq documentation, I couldn't see a way to stack two math environments horizontally. It seemed to focus on floating text tags to the right of the equations. It's possible I missed it, though. Is there a specific command I should look at?
Alex R
+2  A: 

I'm not sure exactly what you're trying to achieve, but amsmath's align* environment might do what you want (without resorting to minipages):

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{align*}
x&=y       & X&=Y       & a&=b+c   & mn&=ab\\
x’&=y’     & X’&=Y’     & a’&=b    & m'n'&=a'b'\\
x+x’&=y+y’ & X+X’&=Y+Y’ & a’b&=c’b & m'&=a'
\end{align*}

\end{document}

As to your minipage question: it requires a width because TeX needs to know where to break the lines. If you don't want the line-breaking algorithm to be used, you probably don't want a minipage.

Edit:

If you want multiple columns and don't care about the vertical alignment of material across the columns, that can be obtained easily enough with the multicols package:

\documentclass{article}

\usepackage{multicols}
\usepackage{lipsum}% just for some example text

\begin{document}

% The * version allows the columns to have ragged bottoms.
% The argument 2 is the number of columns.
\begin{multicols*}{2}
\lipsum[1]% one paragraph of Lorem ipsum.. filler text
\vfil% fills the remainder of the column with white space
\columnbreak% force a column break
\lipsum[2]% another paragraph of text
\vfil% fills the remainder of the column with white space
\end{multicols*}

\end{document}
godbyk
when I looked at multicols, I didn't realize you could force column breaks. Thank you.
Alex R