6

In Latex, the following MWE:

\documentclass{article}

\begin{document}
Hello World\linebreak
Hello World\linebreak
Hello World\linebreak
Hello World
\end{document}

leaves each line fully justified (to horrible effect).

But In ConTeXt, neither \crlf, nor \\, nor any of the documented line delimiters seem to have this behaviour:

\starttext
Hello world \crlf
Hello world \\
Hello world | |
Hello world
\stoptext

I've scoured the wiki and looked through the reference manual for a solution, unsuccesfully.

  • Did you try \break? Hello world\break seems to do. – egreg Jul 17 '15 at 22:03
  • 1
    Thanks, you're right. Not one mention of it in a 350+ pg reference manual, nor the wiki. Goodbye, ConTeXt. – Jared Kulik Jul 17 '15 at 22:10
  • 1
    @JaredKulik: \break is defined in plain TeX. Like LaTeX, ConTeXt also includes many macros that are defined in plain TeX without documenting them. – Aditya Jul 19 '15 at 01:47
  • BTW, why do you want to do this? See the XY problem. There may be more canonical way to achieve the desired effect in ConTeXt. – Aditya Jul 19 '15 at 01:51
  • 1
    @Aditya, Duly noted. LaTeX does offer and document its own way of doing it even if TeX can be used, ConTeXt doesn't and I was left scratching my head. Not worth arguing over. – Jared Kulik Jul 19 '15 at 12:33
  • I had a specific question and got a specific answer. There's nothing wrong with that as far as I can see. See Seperate Question for background, and new Question for followup. – Jared Kulik Jul 19 '15 at 12:34

2 Answers2

4

As @egreg noted, \break does the job.

  • 1
    Note that \break is essentially \penalty-10000, so it will also cause a page break if issued between paragraphs. – egreg Jul 18 '15 at 05:38
  • @egreg: IIUC, \linebreak is essentially \penalty-1000 followed by \hskip \lastskip if \lastskip > 0pt. In the LaTeX example included in the MWE above, wont \linebreak also expand to penalty -1000? – Aditya Jul 19 '15 at 01:50
  • @Aditya but this isn't about linebreak, it's about a break that does not break a page with the startlinealignment environment. Of course there is pagebreak, but that's not the point. And one also has \hbox to \hsize bla bla \break, but that's not the point either. Also, I'm getting a Lua linebreak filter failed reverting to default ad infinitum here. Any insights about it, your majesty? :) – doed Jul 19 '15 at 12:57
1

To justify a single line of text you use \maxaligned or \startmaxaligned. For the same effect for the last line in a paragraph you can use the paragraph keyword for the \startalignment environment.

\starttext

\startlinealignment[max]
Hello world
\stoplinealignment

% \startmaxaligned
% Hello world
% \stopmaxaligned
%
% \maxaligned{Hello world}

\startalignment[paragraph]
\input ward
\stopalignment

\stoptext

Example for justified text.

Wolfgang Schuster
  • 9,400
  • 1
  • 16
  • 19