3

Alright, so obviously if I want to center a certain text I use the enviroment function as followed:

\begin{center} text to be influenced \end{center}

But why can't I instead use the group function to center a certain text like this:

\bgroup \centering text to be influenced \egroup

or

{\centering text to be influenced}

both of the group examples just produce regular, non centered text for some reason. If I leave the \bgroup \egroup // the {} and just do as followed \centering text to be influenced

obviously all the text that follows after \centering gets centered up until I use a different arrangment command. I just don't understand why it's doing nothing if I put the \centering in a group.

Any Help?

PS I'm an absolute noob as you might see.

1
  • 3
    add a \par before the closing brace/\egroup.
    – user4686
    Sep 20, 2018 at 18:36

1 Answer 1

2

The paragraph is processed when a \par (or a blank line) is found.

So in your second and third example, the \centering command has no effect when you exit the group, and the paragraph (when finished) will be processed with whatever configuration you had before.

So you should use {\centering text to be centered \par} or

\bgroup 
\centering
Text to be centered

\egroup 

(notice the blank line).

The center environment add a \par before the end (and additional space, too, normally).

You must log in to answer this question.

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