Math & Sciencebrackets problem

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
shoshia
Posts: 2
Joined: Mon May 11, 2009 1:31 pm

brackets problem

Post by shoshia »

Hello all
I'm trying to make small CPP tutorial and try to show function type, name, arguments and body:
First code

Code: Select all

\begin{eqnarray*} 
\begin{aligned}
\overbrace{int}^{\text{TYpe}}  \overbrace{sqequation}^{\text{Name}} &
 \overbrace{(const\  double\& \ a, const\  double\& \ a,const\  double\&\  a)}^{\text{Parameters}} \\
\end{aligned}
\\
\left.
\begin{aligned}
\{& \\
&\boxed {\phantom{a+b}}\\
&\boxed {\substack{\text{program} \\ \text{code}}   } \\
&\boxed {\phantom{a+b}}\\
\}& \\
\end{aligned} \right\}\quad\text{ Body}
\end{eqnarray*}
second code

Code: Select all

\begin{eqnarray*} 
\left.
\begin{aligned}
\overbrace{int}^{\text{ტიპი}}  \overbrace{sqequation}^{\text{name}} &
 \overbrace{(const\  double\& \ a, const\  double\& \ a,const\  double\&\  a)}^{\text{Parameters}} \\
\{& \\
&\boxed {\phantom{a+b}}\\
&\boxed {\substack{\text{Program} \\ \text{code}}   } \\
&\boxed {\phantom{a+b}}\\
\}& \\
\end{aligned} \right\}\quad \text{ Body}
\end{eqnarray*}
Problems:
with one code \right} is "too high"--it must be below function.
with another one function body is shifted .
any ideas?
maybe matrix approach can give right solution?

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

brackets problem

Post by localghost »

First of all read a paper about the reasons why not to use the eqnarray environment [1]. Afterwards start using the align environment from the amsmath package and try again to align the math expression.

[1] The PracTeX Journal - TeX Users Group, Lars Madsen: Avoid eqnarray!


Best regards and welcome to the board
Thorsten
Post Reply