LyXBoxed equations in Lyx

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
dlorenz
Posts: 10
Joined: Mon Jul 28, 2008 3:03 pm

Boxed equations in Lyx

Post by dlorenz »

Hi everyone,

I need to put some equations into a box (one box per equation, or in some cases one box surrounding two equations located on the same line). Can anyone explain how can I do that? I suppose I should add some LateX code, but how exactly?

Thanks a lot in advance!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Re: Boxed equations in Lyx

Post by Juanjo »

Enter, as usual, in math mode (for example, Insert > Math > Display Formula). Type \boxed and a space. A box appears. Type inside.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
dlorenz
Posts: 10
Joined: Mon Jul 28, 2008 3:03 pm

Re: Boxed equations in Lyx

Post by dlorenz »

Thanks a lot. I tried and it works. However I still have a problem when I need to insert aligned equations (using AMS). Can you please help???
Thanks!!!
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Re: Boxed equations in Lyx

Post by Juanjo »

The strategies differ depending on whether the formulas are numbered or not and whether the frame includes also the equation numbers, if any, or not. Please, write the formulas without frames, export to LaTeX, copy here the code, post also a screenshot to see their appeareance, and explain how you want the frame to be put. It seems to me that, in any case, you will have to use ERT.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
dlorenz
Posts: 10
Joined: Mon Jul 28, 2008 3:03 pm

Boxed equations in Lyx

Post by dlorenz »

The formulas are numbered, but the frame should not include the number.
Here is the code of the equation without frame:

Code: Select all

Code, edit and compile here:
\begin{alignat}{1}
\Delta\delta g_{T} & =\frac{1}{l_{m}}\left[\delta\mathbf{g}\cdot\mathbf{nn}\cdot\Delta\mathbf{m}+\delta\mathbf{m}\cdot\mathbf{nn}\cdot\Delta\mathbf{g}-\xi\delta\mathbf{m}\cdot\mathbf{nn}\cdot\Delta\mathbf{m}+\right.\nonumber \\
& \left.-\frac{g_{N}}{l_{m}}\left(\delta\mathbf{m}\cdot\mathbf{tn}\cdot\Delta\mathbf{m}+\delta\mathbf{m}\cdot\mathbf{nt}\cdot\Delta\mathbf{m}\right)\right]\label{app-ddgt}\end{alignat}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Thanks!!
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Boxed equations in Lyx

Post by Juanjo »

Use ERT to write this:

Code: Select all

Code, edit and compile here:
\begin{equation}\label{app-ddgt}
\boxed{
\begin{aligned}
\Delta\delta g_{T}
=\frac{1}{l_{m}}\Bigl[&\delta\mathbf{g}\cdot\mathbf{nn}\cdot\Delta\mathbf{m}
+\delta\mathbf{m}\cdot\mathbf{nn}\cdot\Delta\mathbf{g}
-\xi\delta\mathbf{m}\cdot\mathbf{nn}\cdot\Delta\mathbf{m} \\
& -\frac{g_{N}}{l_{m}}\bigl(\delta\mathbf{m}\cdot\mathbf{tn}\cdot\Delta\mathbf{m}
+\delta\mathbf{m}\cdot\mathbf{nt}\cdot\Delta\mathbf{m}\bigr)\Bigr]
\end{aligned}
}
\end{equation}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
If the textwidth were big enough, I would even prefer this:

Code: Select all

Code, edit and compile here:
\begin{equation}\label{app-ddgt}
\boxed{
\begin{aligned}
\Delta\delta g_{T}
=\frac{1}{l_{m}}\Bigl[&\delta\mathbf{g}\cdot\mathbf{nn}\cdot\Delta\mathbf{m}
+\delta\mathbf{m}\cdot\mathbf{nn}\cdot\Delta\mathbf{g} \\
& -\xi\delta\mathbf{m}\cdot\mathbf{nn}\cdot\Delta\mathbf{m}
-\frac{g_{N}}{l_{m}}\bigl(\delta\mathbf{m}\cdot\mathbf{tn}\cdot\Delta\mathbf{m}
+\delta\mathbf{m}\cdot\mathbf{nt}\cdot\Delta\mathbf{m}\bigr)\Bigr]
\end{aligned}
}
\end{equation}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Please note that in your original code there was a superfluous + at the end of the first line. Likewise, the opening and closing brackets hadn't the same size. The second line must start at the right of the opening bracket. Finally, the alignat environment is not, in this case, the more appropriate one. If you find that the frame is too close to the formula, right before \boxed, add

Code: Select all

\addtolength{\fboxsep}{5pt}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
(or a different length instead 5pt).

LyX is quite helpful, but, when things become more complex, a good understanding of the underlying principles, commands and environments is required. It would be good for you to read some manuals about LaTeX and, in particular, about math mode.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
dlorenz
Posts: 10
Joined: Mon Jul 28, 2008 3:03 pm

Re: Boxed equations in Lyx

Post by dlorenz »

Thanks a lot!!
Post Reply