5

I'm experimenting (using TeXLive 2013) with having my punctuation marks extend fully into both the left and right margins. I don't know how to include images so I'll do my best to format this here to show what I'm saying:

 Text with normal space
"Quotation mark hanging"
 text with normal space

If I use pdfTeX and microtype with the following code, it works:

\documentclass{article}
\usepackage{microtype}
\LoadMicrotypeFile{cmr}
\SetProtrusion 
{encoding=OT1,family=cmr}
{\textquotedblleft = {1000, },\textquotedblright = { ,1000}}
\begin{document}
Text\\
text\\
"text"\\
text.
\end{document}

(You can't see the right margin but it works also). But of course I want to use LuaLaTeX so I can get all my fancy fonts, but to keep things simple:

\documentclass{article}
\usepackage{fontspec}
\usepackage{microtype}
\LoadMicrotypeFile{cmr}
\SetProtrusion 
{encoding=OT1,family=cmr}
{\textquotedblleft = {1000, },\textquotedblright = { ,1000}}
\begin{document}
Text\\
text\\
"text"\\
text.
\end{document}

And compile with LuaLaTeX, I get the normal protrusion (about half a quotation mark even if I use 0 or 3000 for the modification) but it's the exact same as if I didn't include all that "\SetProtrusion" business. And since I'm using LuaLaTeX I want to be able to use my own fonts so if I do:

\documentclass{article}
\usepackage{fontspec}
\usepackage{microtype}
\setmainfont[Ligatures=TeX]{Garamond Premier Pro}
% \LoadMicrotypeFile{cmr}
\SetProtrusion 
{encoding=OT1,family=Garamond Premier Pro}
{\textquotedblleft = {1000, },\textquotedblright = { ,1000}}
\begin{document}
Text\\
text\\
"text"\\
text.
\end{document}

Which produces something that looks no different than had I just used microtype without the "\SetProtrusion" business, i.e., the normal amount of protrusion.

The hanging package exists and does a decent job but does not include any means to control the amount of protrusion plus the manual cautions about using it as it treats punctuation marks as commands and not glyphs (I do not understand the distinction) and then of course I'm not sure how it works/conflicts with microtype (though I guess one could turn off protrusion in microtype and just let hanging deal with that?)

There's also:

\usepackage[factor=3000]{microtype}

Which gets the left-side hanging punctuation I want but really screws up the right side.

There are other questions dealing with similar ideas but some of them are old and others mention something about using Renderer=Basic but not only does this not help but it looks like it turns off protrusion altogether or at the very least makes the quotation marks look weirdly spaced out. And then other questions do not appear to deal with system fonts.

So really what it all comes down to is that I cannot figure out how to specify protrusion settings when using LuaLaTeX and microtype or if this is even possible.

  • You can answer you own questions. This is preferred to editing the answer into the question. – Martin Schröder Jul 16 '13 at 16:46
  • @MartinSchröder thanks for that! I've edited my question and submitted a new answer. – bfootdav Jul 16 '13 at 19:27
2

OK, this works, apparently I wasn't choosing the correct encoding and using the asterisk solved it:

\documentclass{article}
\usepackage{fontspec}
\usepackage{microtype}
\setmainfont[Ligatures=TeX]{Garamond Premier Pro}
\SetProtrusion 
{encoding= *}
{\textquotedblleft = {1000, },\textquotedblright = { ,1000}}
\begin{document}
Text\\
text\\
"text"\\
text.
\end{document}

I'm not sure why OT1 didn't work or if there are any problems using the asterisk instead, but it worked with several different typefaces so I guess my question is answered.

  • 2
    Take a look at (e.g.) the documentation for fontenc (if on TeX Live, type texdoc encguide in a terminal) if you are interested in what the OT1 encoding is. It isn't 'OpenType' if that's what you were assuming. – jon Jul 16 '13 at 19:46
  • Ah, @jon, I see "OT" and assume Open Type. I looked through encguide and tried several of the encodings (T1, TS1, PU, etc.) but none of them would work. Is there a potential problem using the asterisk? I'm assuming the asterisk is a wild card but is that even accurate? – bfootdav Jul 16 '13 at 21:14
  • 1
    No, none of those encodings are appropriate for any OpenType font. I pointed to the document so you could get a better understanding of what 'OT1' meant. (In general, you should use T1 with lmodern if you want to use a Computer Modern equivalent with microtype on pdfTeX.) For XeTeX (i.e., xelatex), the encoding is EU1; for LuaTeX (i.e., lualatex), use EU2. Or, the asterisk, which is, as you guessed, a wild card. EU1 and EU2 are mainly equivalent to T1 settings, but are 'incomplete' since OpenType fonts can contain thousands of glyphs so it is hard to be complete. – jon Jul 16 '13 at 22:03
  • @jon, thank you very much for the explanation. So of course EU2 works in my example as well. Every day there's more to learn .... – bfootdav Jul 17 '13 at 0:42
  • Glad I could help! – jon Jul 17 '13 at 0:46

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.