# How to center some star signs

In the text environment, I want to centering some stars between paragraphs. I know I can do this by

 \begin{center}
\color{cyan}\makebox[5cm]{* * * * * * * * * * * * * * * * * * * *}
\end{center}


but the vertical space is hard to control. I do not know why the following does not work

$\centering{\color{cyan}\makebox[5cm]{* * * * * * * * * * * * * * * * * * * *}}$


The result will not in the center.

• \centering{$\color{cyan}\makebox[5cm]{* * * * * * * * * * * * * * * * * * * *}$} does it for me... note that $ structurally is an environmentlike structure where a lot of macros don't work... – AndiW Dec 5 '18 at 13:33 • why not for me ? – thone Dec 5 '18 at 13:35 • did you put the \centering outside of the $? If that still does not work you should provide a MWE and tell us which latex you use – AndiW Dec 5 '18 at 13:38

Try

\documentclass{article}
\usepackage{color}
\begin{document}
\makebox[\textwidth][c]{$\color{cyan}\makebox[5cm]{* * * * * * * * * * * * * * * * * * * *}$}

nice
\end{document}

• \centering does not take an argument, this will center the rest of the document. – TeXnician Dec 5 '18 at 13:47
• eventualy \centerline{$\color{cyan} ....$} – Zarko Dec 5 '18 at 13:53
• @TeXnician oups - sorry. fixed. – AndiW Dec 5 '18 at 13:54
• Thanks, friends. Zarko and AndiW . Your codes both work! – thone Dec 5 '18 at 14:03
• You're definitely short a \noindent. Also, there seems to be no need for the internal \makebox or switches to math mode... – Werner Dec 12 '18 at 7:55

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{xcolor}
\usepackage{lipsum}
\newcommand{\cstars}{\vskip 1.2ex\noindent\par\makebox[\linewidth]{\color{cyan}* * * * * * * * * * * * * * * * * * * *}\par}

\begin{document}

\lipsum[2]
\cstars
\lipsum[11]

\end{document}


• No need to use [1][20] - it's not used in the definition of \cstars – AndiW Dec 12 '18 at 0:18
• That's. I guess I copied an initial version with the number of stars as an optional argument, then decided it was unnecessary, and forgot to remove the arguments. Thanks for pointing it! – Bernard Dec 12 '18 at 0:24
• :) you're welcome... – AndiW Dec 12 '18 at 0:26

A simple centred paragraph:

\documentclass{article}

\usepackage{xcolor}
\usepackage{lipsum}

\newcommand{\stars}{%
\par
\nobreak
{\centering\color{cyan}\raisebox{-.7ex}[0pt][0pt]{* * * * * * * * * * * * * * * * * * * *}\par}%
}

\begin{document}

\lipsum[2]

\stars

\lipsum[2]

\end{document}