# How to put the number of the formula to the right side?

I am using LaTeX to create a formula, however, I have found that the placement of the number (in my case, (2)) of the formula is too close. I want to put the number at the right side.

This is my code:

\documentclass{article}
\usepackage[utf8]{inputenc}

\begin{document}

$${C_m = (D_m_1, D_m_2, ..., D_m_k__m}), (m \in (1, j))$$
\end{document}

\end{document}



How should I change my code?

• Please extend your sniplet to a full but minimal example that others can copy and test as is. Here there is no document class or preamble. Additionally your image does not match the code provided. May 16 at 14:12
• The code shown can not possibly make the ouput shown, so impossible to say what to change. May 16 at 14:27
• You must get an error from D_m_1 After any error don't even look at the ouput, TeX only recovers enough to syntax check the rest of the document, not to make sensible output. May 16 at 14:29
• Is "formel" a math term I'm not familiar with, or should this be "formula"? May 16 at 14:43
• Sorry for that, I just updated my code May 16 at 14:56

when I run your code on my computer, I get several error messages, due to the double subscript" (eg D_m_2). Use D_{m_2}. You write you equation {......(........} ......). First, the {....} is not necessary in this case, and the (...) should be open and closed within the {...}, Ex: {....(...)... .}

Are all the parentheses really necessary?

The code below worked for me.

\documentclass{article}
\usepackage[utf8]{inputenc}

\begin{document}
$$C_m = (D_{m_1}, D_{m_2}, ..., D_{mk_m}), (m \in (1, j))$$
\end{document


• Thanks a lot! That works! May 16 at 15:17
• That doesn't change the position of the number, it just moves the formula itself slightly to the left. The OP must have been using different settings or the result was a byproduct of the code errors, as they're not getting it all the way on the right to begin with, as one would with your code, with or without the \quad. May 16 at 15:20
• and ... should be \dots May 16 at 15:56

The reason why the number is close to the equation is that a } is missed in the input. The codes should be revised and improved in the following way.

\documentclass[runningheads]{llncs}

\begin{document}
$$C_m = (D_{m1}, D_{m2},\cdots, D_{mk_m}),$$
where $m \in (1, j)$.
\end{document}
`