6

I have a question, whether there is some possibility to adjust kerning around some specific symbols without caring what symbols will be written next. Also, could I possibly adjust kerning only for specific font shapes?

Specifically, I need to use the Alegreya font, but I've noticed that some symbols (e.g., double quote marks, f letter) leave very little space after themselves.

Please, look at the picture and its source code below: italic shape looks worse than roman, I almost can't tell if there is some space between some words or not. Only inserting double space makes the difference.

Alegreya font

\documentclass{article}
\usepackage{amsmath}
\usepackage{fontspec}
\setmainfont[
  Numbers=OldStyle,
  Extension = .ttf,
  UprightFont= *-Regular,
  BoldFont=*-Bold,
  ItalicFont=*-Italic,
  BoldItalicFont=*-BoldItalic,
  SmallCapsFont=*SC-Regular,
  ItalicFeatures={SmallCapsFont=*SC-Italic},
  ]{Alegreya}

\begin{document}
    Types of $^\text{6}_\text{4}$ chords.\par
    \textit{Types of $^\text{6}_\text{4}$ chords.}\par
    ``good'' harmonic progressions of motion,'' most cases are\par
    \textit{``good'' harmonic progressions of motion,'' most cases are}\par
    \textit{``good' harmonic progressions of motion,' most cases are}\par
    \textit{``good''\/ harmonic progressions of motion,''\/ most cases are}\par
    \textit{``good''~harmonic progressions of motion,''~most cases are}\par
    \textit{``good''~~harmonic progressions of motion,''~~most cases are}\par
    \textbf{``good'' harmonic progressions of motion,'' most cases are}\par
    \textbf{\textit{ ``good'' harmonic progressions of motion,'' most cases are}}\par
    transformed himself transformed himself\par
    \textit{transformed himself transformed himself}    
\end{document}

I've seen some suggestions to use microtype package (e.g., non-invasive kerning/spacing modification: what options are there?), but I've noticed, that microtype and word breaking does not work so great together. Please see the image and its source code below (tested with TeX Live 2015 LuaTeX): notice the word-break hyphen alignment with and without the microtype package.

Microtype and word breaking

\documentclass[twocolumn]{article}
\usepackage{lipsum}
\usepackage{microtype}
\usepackage{fontspec}
\setmainfont[
  Numbers=OldStyle,
  Extension = .ttf,
  UprightFont= *-Regular,
  BoldFont=*-Bold,
  ItalicFont=*-Italic,
  BoldItalicFont=*-BoldItalic,
  SmallCapsFont=*SC-Regular,
  ItalicFeatures={SmallCapsFont=*SC-Italic}
  ]{Alegreya}

% code to draw two column margin is taken from:
% https://tex.stackexchange.com/questions/271285/show-frame-margin-in-two-column-layout/271294 
\usepackage{showframe}
\newlength\Fcolumnseprule
\setlength\Fcolumnseprule{0.4pt}
\makeatletter
\def\@outputdblcol{%
  \if@firstcolumn
    \global \@firstcolumnfalse
    \global \setbox\@leftcolumn \box\@outputbox
  \else
    \global \@firstcolumntrue
    \setbox\@outputbox \vbox {%
                         \hb@xt@\textwidth {%
                           \hb@xt@\columnwidth {%
                             \box\@leftcolumn \hss}%
                           \vrule \@width\Fcolumnseprule\hfil
                                {\normalcolor\vrule \@width\columnseprule}%original:
                                                %\normalcolor\vrule \@width\columnseprule
                           \hfil\vrule \@width\Fcolumnseprule
                           \hb@xt@\columnwidth {%
                             \box\@outputbox \hss}%
                                             }%
                              }%
    \@combinedblfloats
    \@outputpage
    \begingroup
      \@dblfloatplacement
      \@startdblcolumn
      \@whilesw\if@fcolmade \fi
        {\@outputpage
         \@startdblcolumn}%
    \endgroup
  \fi
}
\makeatother

\begin{document}
\section{Without microtype}
\microtypesetup{activate=false}
\lipsum[3]
\section{With microtype}
\microtypesetup{activate=true}
\lipsum[6]
\end{document}

I would be very grateful for some suggestions.

EDIT: Henri Menke showed me, that setting protrusion=False, helps to fix hyphen alignment using microtype package. So I tried to fix my initial problem using \SetExtraKerning only to find out that kerning option is not available for LuaTeX.

17
  • 4
    Welcome to TeX.SX! Side-comment: I don't get the comparison with and without microtype since you don't use the same \lipsum[x] (i.e. didn't you want to use \lipsum[3] in both paragraphs?). Anyway, the fact that hyphen are a bit in the margin is what you want to achieve with microtype. Without showframe, each line should looks better balanced.
    – ebosi
    May 25 '16 at 8:43
  • 5
    microtype enables margin kerning, which is why the hyphen is kerned into the margin. You turn it off with protrusion=false. Word breaking will always be bad for Lorem Ipsum in LaTeX, because there are no hyphenation patterns for ancient Latin built in. The default patterns are for English, so your text is hyphenated as if it was in English. May 25 '16 at 8:51
  • 3
    @liolliokas BTW: If it is mainly interword spacing that is too tight for you, you might want to consider the WordSpace option of fontspec which multiplies the interword space with the given factor, e.g. \setmainfont[WordSpace=1.5]{Alegreya} for one-and-a-half word space. May 25 '16 at 11:33
  • 1
    @liolliokas Yeah but a comparison doesn't really work well if you don't use all the same factors except the one which the comparison is about.
    – Alenanno
    May 25 '16 at 11:53
  • 1
    @liolliokas Then use something smaller than 1.5. These questions are also related tex.stackexchange.com/questions/10455/… tex.stackexchange.com/questions/52929/… May 28 '16 at 9:52

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.