0

I need to enumerate some lines and some equation of a document, and since I need ome freedom editing the layout I want to put manually some numbers at the end of a line. I've found a solution when the line is not centered, that is using text or equation \qquad\hspace*{\fill} number or anything else at the end of the line. Now, clearly if I use:

\begin{center} text \end{center}\qquad\hspace*{\fill} number

The text will not be centered. How can I obtain the same result but with text centered and number on the right?

  • please provide a mwe (minimal working example, a small but complete document) by which you show your attempt. tag is defined for manual numerating equations, why you not like to use it and invent own solution? – Zarko Jun 21 '18 at 11:10
2

Like this? (I'm sure that there is other more professional option)

\documentclass{report}
\usepackage{lipsum}

\begin{document}
\lipsum[1]
\begin{center}
text here\\
\hfill{}text here\hfill\llap{(1)}\\
text here
\end{center}
\lipsum[2]
\end{document}

enter image description here

2

You can still use equation:

\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum} % for context

\newenvironment{numberedtext}[1]
 {\begin{equation}\tag{#1}\begin{minipage}{0.9\textwidth}\centering}
 {\end{minipage}\end{equation}}

\begin{document}

\lipsum*[3]
\begin{numberedtext}{1}
some text to be centered
\end{numberedtext}
\lipsum*[4]
\begin{numberedtext}{42}
some other text
\end{numberedtext}
\lipsum[5]

\end{document}

In order to ensure there is space for the number, the width of the minipage is less than the textwidth.

enter image description here

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.