TeX - LaTeX Asked on March 27, 2021
The simplest way to put this: I need "fj" ligature. It is absolutely crucial especially as I am writing in Icelandic it simply cannot be missed, it just if not more common as fi.
Here is what i’ve found:
usepackage{Alegreya}
This font does include the fj ligature but I really like Computer Modern. I saw a different answer on TeX.SX and found someone who made a good looking one but it had to be invoked with fj
. I think that would be really silly.
Any ideas?
A helpful fellow on the IRC found this:
Computer Modern: extralig package
but I wasnt able to get it working, (I got it into path and LaTeX loaded the package just fine but it did absolutely nothing)
after having had used STIX2 which looks good but a little too heavy/bold for my taste, I had a dream yesterday night. It was the solution. By using a hack with manual kerning and creation of the fj
ligature and extraligfj
command and with LuaLaTeX
on-the-fly text-replacement I have created a seamless solution.
ProvidesPackage{extralig}
usepackage{xcolor}
usepackage{luacode}
newcommand{extraligfj}{fillap{textcolor{white}{rule[-0.05em]{0.252em}{0.55em}}}kern-0.01emllap{j}kern-0.05emrelax}
begin{luacode}
local function vartosrcvar ( line )
return string.gsub(line, "fj" , "extraligfj{}")
end
luatexbase.add_to_callback( "process_input_buffer", vartosrcvar, "var_to_srcvar")
end{luacode}
By saving this code as extralig.sty
in your .tex
file directory and calling it with usepackage{extralig}
it will work perfectly!
Obviously because of the Lua code you must compile this with LuaLaTeX
You are not required to use this as a package, simply copy everything into your document in corresponding places and it will work fine too but its much cleaner to have it as a seperate package.
How does this work?
extraligfj
, a hack where the i
in fi
is replaced with a j
, making a perfect fj
ligature with some manual kerning. (Thanks to this TeX.SX post!)fj
with extraligfj
, which we defined before.extralig.sty
and ready to be seamlessly loaded into our document as a package.TL;DR Save the code snippet as extralig.sty
and place it the same directory as your .tex
file and load it with usepackage{extralig}
. use LuaLaTeX. This is only guaranteed to work with Computer Modern, no other fonts (they will need manual kerning adjustment). Doing this then fj will automagically be ligatured.
Pros:
f
and j
Correct answer by user224041 on March 27, 2021
This really needs to be addressed in the font, you could try to edit latin modern in fontforge or similar to add the ligature, but simplest is to pick a font that has it.
This is using Stix 2 text font with lualatex (or xelatex would also work)
documentclass{article}
usepackage{fontspec}
setmainfont{STIX2Text-Regular.otf}
begin{document}
mbox{f}imbox{f}j
fifj
end{document}
Answered by David Carlisle on March 27, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP