2

I am using only lualatex, but I believe this question pertains to any engine. I have looked at the microtype docs (both user and code), and even looked in the package code, to no avail.

Unless disabled, microtype automatically loads a mt-fontname.cfg file, if it finds one for the main font. Several of them come with the microtype package. In particular, there is one for the EB Garamond fonts.

I would like to prevent microtype from automatically loading that file. If I specify my own config as package option, it will load my file after it loads the mt-EBGaramind.cfg file. My own file cannot over-write or change anything that was already set in the mt- file. Specifically, I refer to protrusion.

What I have done so far:

(1) Create a do-nothing mt-EBGaramond.cfg file, and put it in texmf-local. Microtype reads it instead of the built-in file. Then I can do what I wish with EB Garamond in my own *cfg file, because nothing was already set.

(2) As above, but put everything I need in that file, so it does not need to be in my own *cfg file.

(3) Specify a different main font, load microtype, then change to the real main font. This sounds like it should work, but I get errors. Did not go very deeply into this.

I note that if I use a font (such as Libertinus Serif) that does not have a mt-LibertinusSerif.cfg file, then I can write what I need in my own *cfg, and it will be used.

My question: Is there a command, or a reliable hack, that will prevent microtype from automatically loading a mt- file? Microtype itself is not disabled.

Why I ask: I have my own protrusion settings for that font.

2
  • no, this cannot be prevented. Just put your own mt-EBGaramond.cfg in texmf-local, and it should be loaded instead of the one provided with the package. Also, if you think you have any improvements of the settings, don't hesitate to send them to me.
    – Robert
    Feb 14 at 0:22
  • Thanks, @Robert for the info. My own settings are not necessary improvements for the general user, but if I do find anything, I will send it along. Consider this as answered.
    – rallg
    Feb 14 at 16:22

1 Answer 1

0

It turns out that there is an easy hack. (Must be easy, if I can do it.) Requires minor edits to microtype.sty. The edits will not affect existing usage.

  1. Near the beginning of microtype.sty add this line:
\ifdefined\MTprefix\else\def\MTprefix{mt}\fi
  1. Find macro \def\MT@find@file and within it, change each mt-#1 to \MTprefix-#1.

Usage: In the document preamble, prior to loading microtype, you may define \MTprefix: \def\MTprefix{something}. If you do not do that, then microtype behaves as always. If you define MTprefix, then microtype will look for something-FontName.cfg instead of mt-FontName.cfg.

If you intentionally define \MTprefix to refer to a file that does not exist, or exists but contains no settings, then you can write font-specific configuration into whatever you use instead of microtype.cfg (via the config package option).

What is happening: Currently, if microtype finds font-specific settings in an mt- file (such as mt-EBGaramond.cfg then you cannot override them later, in your config file. But if it does not find font-specific settings, then you can write them in the config file. Among other things, you can \input settings to the config file, then change them with following code. That allows tweaks large or small.

I am attempting to use this in conjunction with Lua code that can programatically tweak some protrusion settings.

EDIT: I took this over to the GitHub project for microtype.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .