You can use
\multicolumn{2}{l|}{\mbox{Substitute into (1), }V=0}
to give you a vertical rule at the end of your multicolumn
. Here's a complete MWE:
% arara: pdflatex
% !arara: indent: {overwrite: yes}
\documentclass{article}
\usepackage{array}
\begin{document}
\[
\begin{array}{>{\displaystyle}r>{\displaystyle}l|>{\displaystyle}r>{\displaystyle}l|>{\displaystyle}r>{\displaystyle}l}
\frac{\delta^2\psi_L}{\delta x^2} & = -k^2Ce^{ikx}-k^2Re^{-ikx} & \frac{\delta^2\psi_C}{\delta x^2} & = A\kappa^2e^{\kappa x}+B\kappa^2e^{-\kappa x} & \frac{\delta^2\psi_R}{\delta x^2} & = -Tk^2e^{ikx} \\
& & & & & \\
& =-k^2\psi_L & & =\kappa^2\psi_C & & =-k^2\psi_R \\
& & & & & \\
& =-\frac{2mE}{\hbar^2}\psi_L & & =\frac{2m(V-E)}{\hbar^2}\psi_C & & =-\frac{2mE}{\hbar^2}\psi_R \\
& & & & & \\
\multicolumn{2}{l|}{\mbox{Substitute into (1), }V=0}&\multicolumn{2}{c|}{\mbox{Substitute into (1)}}&\multicolumn{2}{c}{\mbox{Substitute into (1), }V=0}\\
& & & & & \\
E\psi_L & =E\psi_L & (E-V)\psi_C & =(E-V)\psi_C & E\psi_R & =\psi_R \\
\end{array}
\]
\end{document}
As a note: it looks you are hard coding a reference using (1)
; it's best to avoid this kind of thing, and use \ref
, \eqref
and friends.
You can get better spacing around your =
symbols by using
\begin{array}{>{\displaystyle}r@{}>{\displaystyle}l|>{\displaystyle}r@{}>{\displaystyle}l|>{\displaystyle}r@{}>{\displaystyle}l}
which removes the column separation; furthermore, you can use, for example
\renewcommand{\arraystretch}{3}
and remove the empty rows to set the row spacing.
% arara: pdflatex
% !arara: indent: {overwrite: yes}
\documentclass{article}
\usepackage{array}
\begin{document}
\[
\renewcommand{\arraystretch}{3}
\begin{array}{>{\displaystyle}r@{}>{\displaystyle}l|>{\displaystyle}r@{}>{\displaystyle}l|>{\displaystyle}r@{}>{\displaystyle}l}
\frac{\delta^2\psi_L}{\delta x^2} & {}= -k^2Ce^{ikx}-k^2Re^{-ikx} & \frac{\delta^2\psi_C}{\delta x^2} & {}= A\kappa^2e^{\kappa x}+B\kappa^2e^{-\kappa x} & \frac{\delta^2\psi_R}{\delta x^2} & {}= -Tk^2e^{ikx} \\
& {} =-k^2\psi_L & & {}=\kappa^2\psi_C & & {} =-k^2\psi_R \\
& {}=-\frac{2mE}{\hbar^2}\psi_L & & {} =\frac{2m(V-E)}{\hbar^2}\psi_C & & {}=-\frac{2mE}{\hbar^2}\psi_R \\
\multicolumn{2}{l|}{\mbox{Substitute into (1), }V=0}&\multicolumn{2}{c|}{\mbox{Substitute into (1)}}&\multicolumn{2}{c}{\mbox{Substitute into (1), }V=0}\\
E\psi_L & {} =E\psi_L & (E-V)\psi_C & {} =(E-V)\psi_C & E\psi_R & {} =\psi_R \\
\end{array}
\]
\end{document}
Following egreg's
suggestion, you can also use a new column type:
\newcolumntype{M}{>{\displaystyle}r@{}>{\displaystyle}l}
which allows you to write
\begin{array}{M|M|M}
You might also like to center the entries on the last row:
\multicolumn{2}{c|}{E\psi_L=E\psi_L} & \multicolumn{2}{c|}{(E-V)\psi_C=(E-V)\psi_C} & \multicolumn{2}{c}{E\psi_R=\psi_R} \\
Sure you can change the column specifiers of an array
. After Ctrl + Shift + M, click the button on the math toolbar. That gives you a dialog looking something like this:
Here you can set the number of rows and columns, and define the column specifiers in the text field at the bottom.
To change an existing column, place the cursor in a column and the go to Edit --> Rows and columns. The first three entries in that submenu is for left, center and right alignment. They have keyboard shortcuts as well:
- left: Alt + MCL
- center: Alt + MCM
- right: Alt + MCR
If you really want to
You can get a better result with array
as well, though I have to admit it's kind of a pain to do it in LyX using the GUI. Unless I've missed something of course, it's not like I ever use LyX (except for answering questions here).
For this I would rather write the whole thing in an ERT. Or use alignat
as Bernard mentioned, which is directly available via Insert --> Math --> AMS alignat.
But anyways, if you like pain, start by going to Document --> Settings --> LaTeX preamble, and add
\usepackage{array}
\newcommand\diff{\mathop{}\!\mathrm{d}} % courtesy of egreg
The array
package allows you to use e.g. >{stuff}
to insert stuff
at the start of every cell in a column. The \diff
macro is for typesetting a differential d, remove the \mathrm
if you don't want it upright. Or don't use it at all.
In your document, add a displayed equation and open the array dialog, as mentioned at the very top of this answer. In the field for specifying columns, write
l@{}>{{}}l@{}>{{}}l
This removes the space between columns, and adds an empty group at the start of the second and third column. The point of the empty group is to get correct space around the equal and minus signs. Don't add any spaces in this string though, that seemed to make it revert to c
columns.
Then fill in the array as you have done in your code, the fractions in the first cell, the =
and \delta
term in the second, and the k_{\mathrm{inf}}
term in the third.
Some notes:
I used a displayed fraction instead of the standard fraction:
To use the \diff
macro, just type \diff
.
There is a Fonts button on the math toolbar just to the right of the fraction button (image above), that you can use to get \mathrm{inf}
in the subscripts for the k
. It's the one with four times the letter A.
You need some vertical stretching of the array
, so place the cursor just before the array
, but inside the math environment, and write
\renewcommand\arraystretch{2.5}
2.5
may not be ideal, so adjust to your liking.
The result of all of this:
And here is the complete .lyx
file that produces the above screenshot.
#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\begin_preamble
\usepackage{array}
\newcommand\diff{\mathop{}\!\mathrm{d}} % courtesy of egreg
\end_preamble
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Standard
\begin_inset Formula
\[
\renewcommand\arraystretch{2.5}\begin{array}{l@{}>{{}}l@{}>{{}}l}
\dfrac{\diff V}{\diff t} & =-\delta_{V} & -k_{\mathrm{inf}}\cdot C\cdot\\
\dfrac{\diff C}{\diff t} & =\lambda-\delta_{C} & -k_{\mathrm{inf}}\cdot C\cdot V
\end{array}
\]
\end_inset
\end_layout
\end_body
\end_document
Best Answer
My suggestion would be to place the equation construction inside an ERT:
You may have to set
amsmath
to be "load always" (Document > Settings... > Math Options) or addto your Document > LaTeX Preamble.
Here is what the output looks like: