# Microtype setting doesn't override previous one if font color matches

I am trying to set tracking, word-spacing, font-color (lets call them (T,W,C)) independently in different parts of the document. In my observation, certain microtype settings don't override old ones if font color is same.

The code below is a test-case with 3 boxes to showcase the problem. The aim is to have (T,W,C) independent of each other in the boxes. Box-2 and Box-3 have same (T,W) but different C. We will vary the (T,C) for Box-1 over 3 runs.[1] During Run-1, Box-1's (T,C) matches that of Box-2, but W does not. For this run, the line breaking in Box-2 is different than Box-3, even though their (T,W) values match (this is unexpected result). In Run-2 we make Box-1's C different from Box-2, now all of a sudden line breaking in Box-2 matches that of Box-3 (which is to be expected as their (T,W) and contents match). In Run-3 we make Box-1's T different from Box-2, just like in Run-2 the line breaking of Box-2 matches that of Box-3 (which is desired, expected, and all good).

[1] Note: Code below does not need any change for Run-1, and Run-1 is sufficient to recreate the problem. Run-2 and Run-3 are optional if you want to observe the changes.

Code: Perform 3 runs, with comment/uncomment instructions mentioned inline in Box-1.

\documentclass{article}
\usepackage{xcolor}
\usepackage{fontspec}
\usepackage[expansion=false]{microtype}
\usepackage{blindtext}
\usepackage[absolute]{textpos}

\setmainfont{Linux Libertine O}

\begin{document}

\frenchspacing

% Box-1
\begin{textblock*}{0.6\linewidth}[0,0](1in,1in)
\begin{minipage}{1\linewidth}%
% Run1: include, Run2: include, Run3: comment
\SetTracking[spacing={0*,1,1}]{encoding=*}{-20}
% Run1: comment, Run2: comment, Run3: include
%\SetTracking[spacing={0*,1,1}]{encoding=*}{-19}
% Run1: include, Run2: comment, Run3: include
\lsstyle
\blindtext[1]
\end{minipage}
\end{textblock*}

%Box-2
\begin{textblock*}{0.6\linewidth}[0,0](1in,3.8in)
\begin{minipage}{1\linewidth}%
\SetTracking[spacing={0*,1*,1*}]{encoding=*}{-20}
\lsstyle
\blindtext[1]
\end{minipage}
\end{textblock*}

%Box-3
\begin{textblock*}{0.6\linewidth}[0,0](4.1in,3.8in)
\begin{minipage}{1\linewidth}%
\SetTracking[spacing={0*,1*,1*}]{encoding=*}{-20}
\lsstyle
\blindtext[1]
\end{minipage}
\end{textblock*}

\end{document}


Run-1 output: Box-1 settings interfere with Box-2 Run-2 output: No interference Run-3 output: No interference

• I wish you wouldn't add so many options to your question. I'm getting quite dizzy with all the runs and (T,W) (T,C). And why do you add all the texpos boxes around? Can't you use a simple minipage to demonstrate the issue? – Ulrike Fischer Oct 21 '20 at 13:26
• But beside this: this spaces are globally tied to a font, so you need a new font if you want to change them, for example \addfontfeatures{Scale=1.001} would work too. – Ulrike Fischer Oct 21 '20 at 13:30
• @UlrikeFischer I simplified minipage options. Textpos around minipage as I already had a snippet in another unrelated document with 3 boxes positioned in this fashion, saved me some coding time positioning mini pages relative to each other. Not sure how else I could post this question to showcase all 3 cases. I make sure in my questions that Run-1 is generally sufficient to see the problem, and I post the code such that it doesn't need any modification for 1st run. Run2-3 are optional for someone wanting to see what I am saying. I have added a note for the readers for that. – reportaman Oct 21 '20 at 13:35
• @UlrikeFischer If I get your comment right, only word-spacing W is globally tied to a font, and not tracking T? Because changing tracking doesn't require switching to a different font. If that doesn't require switching to a different font, why changing word-spacing does? I would look for a cleaner solution instead of Scale=1.001 as there are multiple such narrow boxes that I intend to copy fit and typeset next to each other, and am banking on flexibility provided by glues as one option. Your hack means I will have to provide unique value to Scale each time... – reportaman Oct 21 '20 at 14:07
• it is as it is. As the fontspec says about WordSpace: "Note that TEX’s optimisations in how it loads fonts means that you cannot use this feature in \addfontfeatures." see tex.stackexchange.com/a/274252/2388 – Ulrike Fischer Oct 21 '20 at 14:08