# linebreak and pagebreak wherever I want with justified margins

I am looking for two commands:

1. \mylinebreak
2. \mypagebreak

The first is supposed to break a line at the very position where the command is set and make the previous line justified (and not raggedright as usual linebreak commands do) and let the following new line being not indented.

The second is analogous to the first and is supposed to break a page at the very position where the command is set and make the previous line (which now is the last line on the previous page) justified (and not raggedright as usual linebreak commands do) and let the following new line (which is then the first line of the new page) being not indented.

I think I know some ways to break a line (\newline or \\ or \par) or a page (\newpage or \clearpage) and I also know how to make a line not indented (\noindent), but how can I fill up the inter-word space equally so that the previous line is justified and not ragged right?

Extra question: I also just realized that when I add \\ or \newline the the inter-word space of all previous lines gets rearranged. This should be avoided. I would like these two commands I am looking for to act as if it was just a normal linebreak or a normal pagebreak with all the usual justification of margins.

Any ideas?

MWE:

% !TEX TS-program = lualatex
\documentclass{scrartcl}
\frenchspacing
\newcommand{\mylinebreak}{\\}
\newcommand{\mypagebreak}{\newpage\noindent}
\begin{document}
But I must explain to you how all this mistaken idea of denouncing pleasure  and
praising pain was born and I will give you a complete account of the system, and
expound the actual teachings of the great explorer of the truth, the\mylinebreak master-builder
of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it
is pleasure, but because those who do not know how to pursue pleasure rationally
encounter consequences that are extremely painful. Nor again is there anyone who
loves or pursues or desires to obtain pain of itself, because it is pain, but because
occasionally circumstances occur in which toil and pain can procure him some great
pleasure. To take a trivial example, which of us ever undertakes\mypagebreak laborious physical
exercise, except to obtain some advantage from it? But who has any right to find fault
with a man who chooses to enjoy a pleasure that has no annoying consequences, or
one who avoids a pain that produces no resultant pleasure?
\end{document}

• Change the class from minimal to article. Also see Why should the minimal class be avoided?. Results are identical, but won't be if you have floats. Also see Why is the use of a doubleslash as a newline indicator outside of tabular bad. – Peter Grill Nov 6 '14 at 21:26
• Aren't \linebreak and \pagebreak what you're looking for? – egreg Nov 6 '14 at 21:29
• @egreg oh, ok. after swtching to scracrtl your suggestion with \linebreak is what I am looking for! Thanks. \pagebreak, however, does not break the pager where the command is but only somewhere in the line where the command is. – ClintEastwood Nov 6 '14 at 21:34
• @ClintEastwood: You are correct. Sorry, should have tested your example first. Deleting comments... – Peter Grill Nov 6 '14 at 21:37

The commands you want are already provided and they are called \linebreak and \pagebreak:

\documentclass{scrartcl}
\frenchspacing

\begin{document}
But I must explain to you how all this mistaken idea of denouncing pleasure  and
praising pain was born and I will give you a complete account of the system, and
expound the actual teachings of the great explorer of the truth, the master-builder
\linebreak
of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it
is pleasure, but because those who do not know how to pursue pleasure rationally
encounter consequences that are extremely painful. Nor again is there anyone who
loves or pursues or desires to obtain pain of itself, because it is pain, but because
occasionally circumstances occur in which toil and pain can procure him some great
pleasure.
\pagebreak
To take a trivial example, which of us ever undertakes laborious physical
exercise, except to obtain some advantage from it? But who has any right to find fault
with a man who chooses to enjoy a pleasure that has no annoying consequences, or
one who avoids a pain that produces no resultant pleasure?
\end{document}


The two commands have the counterparts \nolinebreak and \nopagebreak; each of the four commands can take an optional argument, which should be a digit between 0 and 4 (inclusive) that tell the desirability of breaking or not breaking.

So \linebreak[0] is just a suggestion and is equivalent to \nolinebreak[0], \linebreak[1] is a warm invitation, \linebreak[2] is a bit more urgent, \linebreak[3] is much more compelling and \linebreak[4] is the same as \linebreak, that is, break here and don't discuss further.

If you want both a line break and a page break, use both:

\pagebreak\linebreak


but, in this case, don't leave spaces before \pagebreak:

occasionally circumstances occur in which toil and pain can procure him some great
pleasure.%
\pagebreak\linebreak
To take a trivial example, which of us ever undertakes laborious physical
exercise, except to obtain some advantage from it? But who has any right to find fault

• \linebreak works fine. But about \pagebreak: you see you entered the command after "pleasure." but the break actually occurs after "To take a". – ClintEastwood Nov 6 '14 at 21:37
• @ClintEastwood Use both, it's that simple. – egreg Nov 6 '14 at 21:40
• @ClintEastwood First \pagebreak then \linebreak. – egreg Nov 6 '14 at 21:43
• in a word: cool. – ClintEastwood Nov 6 '14 at 21:43