Math & ScienceEquation and Text in the same Line

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
jcgonzales
Posts: 3
Joined: Sat Jun 08, 2013 5:43 am

Equation and Text in the same Line

Post by jcgonzales »

Hello,

I'm new in this and I need some help. What I want to do is to put an equation first and a text in the same line. I don't get to put them together in the same line and I want to get all (the equation and the text) to the right side, not centered.

I don't get to any solution from anywhere. This is my example:
K_t: Capital that family brings into period t
I tried with this.

Code: Select all

\usepackage{amsmath}

\begin{equation}
\[ k_{t} \] \text{: Capital that family brings into period t}
\end{equation}
Another question: what about if I want first the text and then the equation? Putting them at the right side (not centered)
It doesn't work like this so I really need help!

Thanks a lot in advance!
Last edited by localghost on Sat Jun 08, 2013 8:37 am, edited 1 time 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

tom
Posts: 73
Joined: Thu Apr 18, 2013 4:02 am

Equation and Text in the same Line

Post by tom »

Hi!

You are mixing two display math environments, {equation} and {displaymath} (see below). To suppress the equation number, use the starred versions of amsmath environments equation* and align*.

Code: Select all

\documentclass[11pt]{article}
\usepackage{amsmath}

\begin{document}
  \begin{equation} % single-line equation
    k_{t} \text{: Capital that family brings into period t}
  \end{equation}

  \[  % same as \begin{displaymath}
    k_{t} \text{: Capital that family brings into period t}
  \]  % \end{displaymath}

  \begin{align} % multi-line equation
    k_{t} &\\
    \text{Capital that family brings into period t}&
  \end{align}
\end{document}
jcgonzales
Posts: 3
Joined: Sat Jun 08, 2013 5:43 am

Re: Equation and Text in the same Line

Post by jcgonzales »

Thanks a lot! and what about getting the line (equation and text) to the left side (not centered)? how could I get it?

thanks in advance!
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Equation and Text in the same Line

Post by Johannes_B »

If you want to do that you should do so in the whole document to avoid inconsistencies. Try giving the optional argument fleqn to the documentclass:

Code: Select all

\documentclass[fleqn]{article}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply