1

Minimum Working Example (MWE)

\starttypescript [serif] [storybody]
  \definefontsynonym [Serif] [name:couriernew]
\stoptypescript

\definetypeface[story] [rm] [serif] [storybody] [default]
\setupbodyfont[story]

\setupinterlinespace[line=32pt]

\setuplayout[
  backspace=.75in,
  leftmargin=\zeropoint,
  rightmargindistance=\zeropoint,
  rightmargin=1.25in,
]

\setupalign[hz,hanging,nothyphenated,]
\setuptolerance[stretch,tolerant,]
\setupindenting[yes, 5em, first]

\showframe

\starttext
  \startbodymatter
Architected as a sentinel of capitalism, Skopós orchestrated the future. 
Every day its vast array of power-devouring, refrigerator-sized towers
would crunch through several yottabytes of data.
  \stopbodymatter
\stoptext

Output

The MWE produces the following:

Margin Overflow

Note how some words flow well into the margins.

Desired Output

Adding a manual line break allows the margins to be respected as a hard edge:

Manual Line Break

The code:

\starttypescript [serif] [storybody]
  \definefontsynonym [Serif] [name:couriernew]
\stoptypescript

\definetypeface[story] [rm] [serif] [storybody] [default]
\setupbodyfont[story]

\setupinterlinespace[line=32pt]

\setupalign[hz,hanging,nothyphenated,]
\setuptolerance[stretch,tolerant,]
\setupindenting[yes, 5em, first]

\showframe

\starttext
  \startbodymatter
Architected as a sentinel of capitalism, Skopós orchestrated the future. 
Every day its vast array of\\power-devouring, refrigerator-sized towers
would crunch through several yottabytes of data.
  \stopbodymatter
\stoptext

Problem

Adding manual line breaks throughout the entire text to ensure margins are respected is mixing content and presentation. In my particular situation, I'm generating two different PDFs: a manuscript and an eBook. The fonts, headings, page breaks, and other styles are completely different between the two. Also, manual line breaks are volatile -- if I changed a paragraph, I'd have to re-evaluate its manual line breaks (if any).

Adding manual line breaks would also break the formatting for the eBook because both the manuscript and the eBook are generated from the same markdown source. That is, a single source drives both types of PDF.

Question

How do you force ConTeXt to respect the right-hand margin as a hard limit without resorting to hyphenation? I don't mind if there's a lot of space on the right-hand side. (The right-hand margin can be overlapped by 1em, if absolutely necessary.)

Another way of phrasing this is: how do I guarantee a 1 inch border around the page, without hyphenation?

  • 1
    I'm not quite sure what you want: your code has alignment as hanging and hz, that would suggest you want protrusion. At the same time, you want no hyphenation and a monotype font - this looks somewhat contradictory to me. And the image with your desired output seems to show text that is aligned flushleft, and you don't seem to mind unequal lines. So: the one word that sticks out is a compound. You can add setbreakpoints [compound] to your code, and it will break the line at the hyphen within the word. You can also change tolerant to verytolerant. But I'm not quite sure what you want. – Thomas Dec 3 '15 at 14:22
  • Ah. According to the documentation hanging enables "hanging punctuation," which would be acceptable. I didn't realize it also meant word protrusion. – Dave Jarvis Dec 3 '15 at 19:18
3

Try flushleft:

\starttypescript [serif] [storybody]
  \definefontsynonym [Serif] [name:couriernew]
\stoptypescript

\definetypeface[story] [rm] [serif] [storybody] [default]
\setupbodyfont[story]

\setupinterlinespace[line=32pt]

\setuplayout[
  backspace=.75in,
  leftmargin=\zeropoint,
  rightmargindistance=\zeropoint,
  rightmargin=1.25in,
]

\setupalign[flushleft,hz,nothyphenated,]
\setuptolerance[stretch,verytolerant,]
\setupindenting[yes, 5em, first]

\showframe

\starttext
  \startbodymatter
Architected as a sentinel of capitalism, Skopós orchestrated the future.
Every day its vast array of power-devouring, refrigerator-sized towers
would crunch through several yottabytes of data.
  \stopbodymatter
\stoptext

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.