2

When using microtype, en dashes seem to extend beyond the text body if they appear at the beginning or end of a line. How can I get around this?

MWE:

\documentclass{article}

\usepackage{mathpazo}
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,factor=1100,stretch=10,shrink=10]{microtype}

\begin{document}

Hello, here is some text without a meaning. This text should show
what a printed text will look like at this place. If you read this text,
you will get no information. Really? Is there no information? Is there
a difference between this text and some nonsense like “Huardest gef-
burn”? Kjift – not at all! A blindinginng -- enter text here -- text like this gives you information
about the selected font, how the letters are written and an impression
of the look. This text should contain all letters of the alphabet and it
should be written in of the original language. There is more text in this line until it happens and we need more -- this is important -- no need for
special contents, but the length of words should match the language.
This is the second paragraph. Hello, here is some text without a
meaning. This text should show what a printed text will look like at
this place. If you read this text, you will get no information. Really? Is
there no information? Is there a difference between this text and some
nonsense like “Huardest gefburn”? Kjift – not at all! A blind text like
this gives you information about the selected font, how the letters
are written and an impression of the look. This text should contain
all letters of the alphabet and it should be written in of the original
language. There is no need for special contents, but the length of
words should match the language.

\end{document}

enter image description here

Palatino seems to make this problem even more visible.

Update after initial replies:

I don't want to get rid of protrusion at all. However, the dash looks really misplaced to my eye. I have tried the following but cannot find a way that actually shows any effect:

\SetProtrusion
 { encoding = {T1,OT1},
   family   = {ppl,pplx,pplj} }
   {-- = {0,0}}
languitar
  • 808

1 Answers1

4

Enabling this is one of microtype packages main features so it is a bit odd to load the package at all however you can turn off protrusion into the margin by

\usepackage[activate={true,nocompatibility},
protrusion=false,
final,tracking=true,kerning=true,factor=1100,stretch=10,shrink=10]{microtype}

enter image description here


To customise a single character I thought it should be

\SetProtrusion
 { encoding = OT1,
   family   = ppl }
   {\textendash = {0,0}}

but that did not work but what did work was to copy the ppl config (your log file will show the path on your system)

for me it was

/usr/local/texlive/2017/texmf-dist/tex/latex/microtype/mt-ppl.cfg

and save it to the folder with the document and then change the two settings for \textendash to say 0,0 instead of 300,300

$ diff mt-ppl.cfg~ mt-ppl.cfg
85c85
<      \textendash       = {300,300},   \textemdash        = {200,200},
---
>      \textendash       = {0,0},   \textemdash        = {200,200},
154c154
<      \textendash       = {300,300},   \textemdash        = {200,200},
---
>      \textendash       = {0,0},   \textemdash        = {200,200},
David Carlisle
  • 757,742
  • As far as I understood it, the idea of protrusion is to make the borders of the text more even based on the visual appearance of the characters. However, the dash looks completely misplaced to my eyes. Isn't there a chance just to "fix" this single issue? – languitar May 18 '17 at 13:44
  • @languitar yes sure, see the microtype manual you can scale the factor by which prolusion is allowed or (with more effort) you can tweak the settings on a per font per character basis – David Carlisle May 18 '17 at 13:51
  • Do you know which family I need to set for SetProtrusion in order to change this single character? – languitar May 18 '17 at 14:02
  • 1
    @languitar adding \showthe\font shows \OT1/ppl/m/n/10 so the family is ppl (you should probably be using T1 not OT1 as well (\usepackage[T1]{fontenc}) – David Carlisle May 18 '17 at 14:09
  • I have updated the question with what I have tried, but this still doesn't have any effect. Any idea what's wrong there? – languitar May 18 '17 at 14:18
  • @languitar I updated answer – David Carlisle May 18 '17 at 14:50
  • 2
    You shouldn't change the normal cfg. If you want to overwrite its values you should load it with \LoadMicrotypeFile{ppl} and then use \SetProtrusion. See Roberts answer here https://tex.stackexchange.com/a/124032/2388 – Ulrike Fischer May 18 '17 at 16:07
  • Thanks for the help. What was missing in my case is explained in the marked duplicate: \LoadMicrotypeFile{ptm}. Then, this also works without using a custom file. – languitar May 19 '17 at 07:47