I am not able to figure why Latex do not want to add line break between a pargraph and a text line after that in the following cases. It keeps showing them on the same line. Here is a MWE
(1) no effect
\documentclass[12pt]{article}%
\begin{document}
\paragraph{First solution. Not accounting for mass of pipe}
\bigskip
\underline{Finding the longitudinal (axial) natural frequency.}
\end{document}
(2). Gives error (there is no line to end here)
\documentclass[12pt]{article}%
\begin{document}
\paragraph{First solution. Not accounting for mass of pipe}\\
\underline{Finding the longitudinal (axial) natural frequency.}
\end{document}
(3) gives error (there is no line to end here)
\documentclass[12pt]{article}%
\begin{document}
\paragraph{First solution. Not accounting for mass of pipe}\newline
\underline{Finding the longitudinal (axial) natural frequency.}
\end{document}
(4) No effect
\documentclass[12pt]{article}%
\begin{document}
\paragraph{First solution. Not accounting for mass of pipe}
\vspace{1in}
\underline{Finding the longitudinal (axial) natural frequency.}
\end{document}
(5) Only this worked. Adding \hfill
first, as in \hfill\newline
or \hfill\\
or \hfill\break
etc…
\documentclass[12pt]{article}%
\begin{document}
\paragraph{First solution. Not accounting for mass of pipe}
\hfill \\
\underline{Finding the longitudinal (axial) natural frequency.}
\end{document}
Accroding to https://www.sharelatex.com/learn/Line_breaks_and_blank_spaces it says
But they did not work the same way in my example. The question is why adding \hfill
is needed with paragraph
?
I normally do not use paragraph
tag. I had to use it because reached the end of the subsubsubsection
and needed an extra level and paragraph
was only one left to use and I thought it will work like subsubsection{title}
which automatically puts new line after it.
Best Answer
The error "there is no line to end here" is pretty clear. Like in
\section{foo} bar
, "foo" and "bar" are not in the same line, nor in the same paragraph, even if they are in the same line in source code. After\section{foo}
you are still in vertical mode and you need leave this mode to start a line that can be broken, so\section{foo}\\bar
produce the same error that\paragraph{foo}\\bar
Usually this happen with the next character (the "b" of "bar"), no matter how many spaces or blank lines are before, but there several ways to enter in horizontal mode (star a paragraph) without writing really nothing, so you can break it immediately (for instance,
\leavevmode\\
,\mbox{}\\
or\noindent\\
), but a dirty an easy trick is start the line with a hard space, so~\\
works too.However, seem that you want really use
\paragraph
with the layout of another sectioning commands. Then is much better redefine the command in a similar way, so you need only write\paragraph{foo} bar
. Example:Note: Please do not use underlines, but otherwise is better use
\uline
of theulem
package because this command allow line breaks within the underlined text.