Here is a patch to modify the font used by url
to be configured to use so called base
mode in LuaTeX+luaotfload
lingua. Indeed by default text fonts are declared using node
mode, which (quote) does not work in math mode
whatever that means. The patch modifies the font name to replace mode=node
if present by mode=base
.
But... in the example below I get the Old Style Figures to work, but the tnum
(Tabular Figures) feature does not.
More experimenting reveals that it works separately for one feature (be it Numbers=OldStyle
or Numbers=Monospaced
or Numbers=Proportional
but not with two at the same time; naturally I checked that the font name is correctly prepared in all cases).
\documentclass{article}
\usepackage{fontspec}
\setmainfont{TeX Gyre Termes}[Numbers = {OldStyle, Monospaced}]
\usepackage{url}
\urlstyle{same}
\makeatletter
\ifx\directlua\undefined\else
\begingroup
\catcode`N 12
\catcode`O 12
\catcode`D 12
\catcode`E 12
\lowercase{\gdef\FixFontForMath@i #1=NODE;#2#3\relax #4\@empty}%
{%
\ifx#2\empty
\let\FixedFontForMath\font
\else\font\FixedFontForMath=#1=base;#2#3\relax\fi
}%
\lowercase{\gdef\FixFontForMath {\expandafter\FixFontForMath@i
\fontname\font\relax\relax=NODE;\empty\relax\@empty }}%
\endgroup
\def\Url@FormatString{%
\UrlFont \FixFontForMath \Url@MathSetup
$\fam\z@ \textfont\z@\FixedFontForMath
\expandafter\UrlLeft\Url@String\UrlRight
\m@th$%
% \if\urldebug \showlists \fi
}%
\fi
\makeatother
\begin{document}
http://www.0123456789.org (text)
\url{http://www.0123456789.org} (url)
\hsize 6cm
For some reason the `Tabular' feature is not obeyed in math. But the `Old Style'
feature now is.
\end{document}
% Local Variables:
% TeX-engine: luatex
% End:
biblatex
matter, but rather one of theurl
package as\url{http://example.com/1234567890}
in the document shows. Maybe it is a good idea to make the example even more minimal and removebiblatex
as it is certainly not the culprit here.\url
in quasi-math mode, and math mode uses only lining figures, no oldstyle figures. Juxtapose the output of1234567890
and\url{1234567890}
to see what I mean.url
package respect fontspec font options (stylisticset) with LuaLaTeX. In that posting, note that\path
is an alias for\url
.