Text Formattingspace in equations

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
helllo
Posts: 44
Joined: Sat Jun 05, 2010 5:20 pm

space in equations

Post by helllo »

Hi everyone,
I'm trying to type this in latex :
f*g = a
"space" = b + c
(where "space" is real space)

When I do it in latex this way :

Code: Select all

f*g = a \\
          = b + c
I get this :
f*g = a
= b + c

Any idea how to have the second "=" under the first one ?
Thank you :)
Last edited by helllo on Tue Aug 17, 2010 11:59 pm, edited 3 times in total.

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

php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

space in equations

Post by php1ic »

Hi helllo,

Don't post random bits of code, instead post full a MWE that people can easily compile to see the problem.

For your current question, use the align environment provided by the amsmath package

Code: Select all

\documentclass[a4paper,11pt]{article}

\usepackage{amsmath}

\begin{document}

\begin{align}
f\star g &=a\\
         &=b+c
\end{align}

\end{document}
helllo
Posts: 44
Joined: Sat Jun 05, 2010 5:20 pm

Re: space in equations

Post by helllo »

Thank you !
helllo
Posts: 44
Joined: Sat Jun 05, 2010 5:20 pm

space in equations

Post by helllo »

Hi, is it possible to write a "non-maths" sentence next to one equation when using the align mode ?
like this :

Code: Select all

\documentclass[a4paper,11pt]{article}

\usepackage{amsmath}

\begin{document}

\begin{align}
f\star g &=a (because a>0)\\
         &=b+c
\end{align}

\end{document}
thanks :)
User avatar
Stefan Kottwitz
Site Admin
Posts: 10334
Joined: Mon Mar 10, 2008 9:44 pm

space in equations

Post by Stefan Kottwitz »

Yes, use the \text command:

Code: Select all

\documentclass[a4paper,11pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
f\star g &=a \quad (\text{because }a>0)\\
         &=b+c
\end{align}
\end{document}
Stefan
LaTeX.org admin
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

space in equations

Post by gmedina »

Hi,

you can use either the \text or \textrm command and add some space if there's only one annotated line or use another aligning point (to align the annotations):

Code: Select all

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align}
  f\star g &=a\qquad\text{(because $a>0$)}\\
              &=b+c
\end{align}

\begin{align}
  f\star g &=a & \text{(because $a>0$)}\\
              &=b+c & \text{(because $b=0$)}
\end{align}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
helllo
Posts: 44
Joined: Sat Jun 05, 2010 5:20 pm

Re: space in equations

Post by helllo »

thank you very much :D
Post Reply