3

enter image description here how to align in the right side? to result like in the picture.

2 Answers 2

6

Something like this?

enter image description here

\documentclass{article}
\begin{document}
\begin{enumerate}
\item blabla blabla blabl blabla blabla blabl blabla blabla blabl blabla blabla blabl blabla blabla blabl blabla blabla blabl blabla blabla blabl blabla blabla blabl blabla blabla blabl blabla blabla blabl blabla blabla blabl
\newline\hspace*{\fill}\textbf{(theorem 1)}
\end{enumerate}
\end{document}
9
  • 1
    thanks a lot @mico
    – El Numeral
    Commented May 24, 2020 at 8:41
  • What if the last line is short? You'll get a big hole.
    – egreg
    Commented May 24, 2020 at 12:21
  • Besides, \null is not a documented command and \hspace*{\fill} should be used instead of \null\hfill.
    – egreg
    Commented May 24, 2020 at 12:38
  • @Mico I read a few times the LaTeX manual and I can assure you that \null is not metioned. ;-)
    – egreg
    Commented May 24, 2020 at 13:47
  • 1
    Thank you, that clarifies it :-)
    – Mast
    Commented May 25, 2020 at 14:50
11

You don't want the remark to go to the next line if the last line of the paragraph is short.

Here I propose a better solution, comparing to the output one gets with the code suggested by Mico.

enter image description here

As you see, the other proposal leaves big holes in the second and third case.

The code below comes from another answer of mine.

\documentclass{article}

\newcommand{\what}[1]{% the Bourbaki trick
  \unskip{\nobreak\hfill\penalty50\hskip1em\null\nobreak
   \hfill\mbox{\normalfont\bfseries(#1)}%
   \parfillskip=0pt \finalhyphendemerits=0 \par}%
}

\begin{document}

\section{My proposal}

\begin{enumerate}

\item bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla
\what{Theorem 1}

\item bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla
\what{Theorem 1}

\item bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
\what{Theorem 1}

\end{enumerate}

\section{Less attractive output}

\begin{enumerate}

\item bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla
\newline\null\hfill\textbf{(theorem 1)}

\item bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla
\newline\null\hfill\textbf{(theorem 1)}

\item bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
\newline\null\hfill\textbf{(theorem 1)}

\end{enumerate}

\end{document}
2
  • @Schrödinger'scat No, that's not the result of another answer, which in the test case is good. Check the picture. However, I'll change the wording.
    – egreg
    Commented May 24, 2020 at 20:39
  • thanks a lot! it helps me so much.
    – El Numeral
    Commented May 26, 2020 at 12:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .