LyXMulti-line Formula

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
winterbegins
Posts: 1
Joined: Wed Aug 10, 2011 3:20 pm

Multi-line Formula

Post by winterbegins »

Hi, I am a novice of LyX. Now I am preparing a research paper. I would like to input an optimization problem in the following format:

min f(x) (1)
s.t. x<=a (1a)
x>=b (1b)

"min" and "s.t." need to be aligned along their right-hand side, and the mathematical formula parts need to be aligned along their left-hand side. I want to know how to input this kind of formula in LyX system. Thank you very much.

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Multi-line Formula

Post by kaiserkarl13 »

Try the amsmath package's "align" environment. I don't use LyX, but here's how to do it in LaTeX:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\begin{document}
  \begin{equation}
    \begin{split}
      \min{}& f(x) \\
      \text{s.t.\,} & x <= a \\
        & x >= b
    \end{split}
  \end{equation}
\end{document}
The above code will produce this:

Code: Select all

   min f(x)
  s.t. x <= a
       x >= b
I hope that's what you wanted, because it wasn't clear from your first post.
Post Reply