3
\begin{description}
\item[xyz] \[x=y\]
\end{description}

x=y appears on the line below xyz, if I changed \[x=y\] to some normal text it wouldn't create the new line. How can I stop it?

3
  • 1
    Is \line similar to \item? And, do you want x=y to be horizontally centred just like \[x=y\]?
    – Werner
    Oct 23, 2013 at 19:37
  • 1
    By default, you are entering display mode by using \[\]. Hence, it will automatically create a new line for you in math mode. If you want to use inline math, simply use $<content>$
    – azetina
    Oct 23, 2013 at 19:37
  • @Werner Sorry I meant item, and no, I want x=y to appear on the same line as xyz does, with the math example it goes to a new line. Azetina I don't want inline math
    – Levi H
    Oct 23, 2013 at 20:16

1 Answer 1

4
\documentclass{article}
\everymath{\displaystyle}
\begin{document}
\begin{description}
\item[xyz]$x=y$
\end{description}
\end{document}

Edit

Based on the given comment.

\documentclass[preview,border=12pt]{standalone}
\everymath{\displaystyle}
\newcommand\myitem[2]{\item[$#1$]\hfill$#2$\hfill\null}
\begin{document}
\begin{description}
\myitem{xyz}{\frac10+0^0}
\myitem{\frac10}{0^0}
\end{description}
\end{document}

enter image description here

For those who dislike \everymath

\documentclass[preview,border=12pt]{standalone}
\newcommand\myitem[2]{\item[$\displaystyle#1$]\hfill$\displaystyle#2$\hfill\null}
\begin{document}
\begin{description}
\myitem{xyz}{\frac10+0^0}
\myitem{\frac10}{0^0}
\end{description}
\end{document}
6
  • Is there not a better way other than to just type that every time?
    – Levi H
    Oct 23, 2013 at 19:52
  • 1
    @STRAIGHTOUTTACOMPTON: What do you want to automate? Oct 23, 2013 at 20:01
  • I want it centered, I want display math, but I don't want to have to do a special case of changing how I do math mode everytime I want to do it at the start of an item.
    – Levi H
    Oct 23, 2013 at 20:06
  • @STRAIGHTOUTTACOMPTON: If there is some form of consistency in your usage, then automation is easy. For example, if you always have \item[..] \[...\], then you can write a macro \myitem that formats things the way you want. If not, then it's more difficult.
    – Werner
    Oct 23, 2013 at 20:08
  • 2
    I certainly wouldn't rely on \everymath here, it is considered quite problematic in LaTeX.
    – yo'
    Oct 23, 2013 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.