Even if the question looks familiar, I didn't find any answer. I am working with XelateX, and for some projects I need to use a monospaced font.

For a long time now, I used the default hyphenation and justification of XelateX. But this justification apply the same pattern as a non-monospace font. I mean the space between words are stretched to have the words fitting the line sides.

But I have a dream. And this dream is to replace these stretching spaces by X number of monospace spaces.

An example is better :

What Xelatex give me what Xelatex give me

And what I except What I except

The second example is produced with a verbatim environment, manually. To have always a complete line, instead of stretch a space, I multiply monospace spaces. I hope there is a solution with an automatic process, hyphenation compliant, tutti quanti, as XelateX can do it :)

This is my minimal document :

%%********* setup *********

\documentclass[9pt, titlepage]{report}

% set default langage

% set geometry
    paperheight=297mm, paperwidth=210mm,%
    layoutheight=297mm, layoutwidth=210mm,%
    layoutvoffset=0mm, layouthoffset=0mm,%

% set fonts


%%********* document *********

  • 2
    Glue in TeX is not stretched in discrete steps: all spaces in a line are equal, unless some of them have infinite stretchability; but if you add infinite stretchability to the interword space, all will become the same again (and there will be also funny line breaks). You seem to want to reproduce ugly typewriter output. – egreg Jul 11 '16 at 19:39
  • @egreg the « ugly typewriter output » is purely subjective. For me it is a typographic logical way and better looking way. – krshk Jul 12 '16 at 7:38
  • @egreg Sorry to disturb you Egreg, but even if you find this request incomprehensible, maybe do you know how to do what I am looking for, or maybe do you have some ideas ? – krshk Jul 16 '16 at 17:42

Your Answer

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

Browse other questions tagged or ask your own question.