I am trying align text such that the first line is fully left aligned, and the second line is centered. The following is the desired behaviour with the associated code.
\begin{flushleft}
Step 2:
\end{flushleft}
\begin{center}
chi-squared-test (assuming data is normal)
\end{center}
I usually use \raggedright
and \centering
like the following, but this gives me undesirable behaviour.
\raggedright{Step 2:}
\centering{chi-squared-test (assuming data is normal)}
I also tried inserting a \newline
after the first line, but this also gives me undesirable behaviour.
\raggedright{Step 2:}
\newline
\centering{chi-squared-test (assuming data is normal)}
I have the working section in the first code block, but in an effort to write less, I would prefer to use \raggedright
and \centering
instead. What am I doing incorrectly? Why is the behaviour between the code blocks different? Thanks.
The following is the full document.
\documentclass{article}
\usepackage{ragged2e}
\begin{document}
\begin{flushleft}
Step 2:
\end{flushleft}
\begin{center}
chi-squared-test (assuming data is normal)
\end{center}
\raggedright{Step 2:}
\newline
\centering{chi-squared-test (assuming data is normal)}
\end{document}