# Prevent display math from creating a new line at the start of an item?

\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?

• 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
• 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>$ 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 Oct 23, 2013 at 20:16

\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}


## 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}

• Is there not a better way other than to just type that every time? Oct 23, 2013 at 19:52
• @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. 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
• I certainly wouldn't rely on \everymath here, it is considered quite problematic in LaTeX.
– yo'
Oct 23, 2013 at 20:20