Featured Book

LaTeX Beginners Guide

Who is online

In total there are 9 users online :: 0 registered, 0 hidden and 9 guests (based on users active over the past 5 minutes)
Most users ever online was 1327 on Tue Nov 05, 2013 7:11 pm

Users browsing this forum: No registered users and 9 guests

Partner Sites

TeXwelt - Fragen und Antworten goLaTeX
TeXblog
TeXnicCenter
TeXample

Specifications for Math Numerals

biblatexeulervmmathspecXeTeXAdd tags Information and discussion about fonts and character sets (e.g. how to use language specific characters)

Specifications for Math Numerals

Postby hugovdberg on Fri Feb 21st, 2014

I use mathspec to change the numerals from eulervm to the numerals from my text font, which do blend quite nicely. I have to this because I also use siunitx, and no matter what setting I use, in math mode it will use the euler numerals even if I don't set the euler-digits option. Unfortunately, with the \setmathfont also the digits within the DOI identifiers in my bibliography are changed, and thus look really ugly. I tried using and explicit \setmonofont, that does change the letters and symbols, but still not the digits, whether I set the mono-spaced font before the math font or after it. Also note I only set the FreeMono as mono-spaced font for extra contrast to see what changed, I think it's rather ugly and definitely prefer a font better fitting with the rest of the text.

Below are the files "test2.tex", and "test2.bib" (sorry, "test.tex" was already actively in use ;) ) I also attached the corresponding output on my system.

Code: Select all  •  Open in writeLaTeX
\documentclass{scrartcl}
\usepackage{amsfonts}
\usepackage{eulervm}

\usepackage{siunitx}
\sisetup{
  detect-all
}

\usepackage{mathspec}
\setmainfont[
  Ligatures={Common,TeX},
  Numbers={OldStyle,Proportional}
]{Calluna}
\setsansfont[
  Ligatures={Common,TeX},
  Numbers={Lining,Proportional}
]{Calluna Sans
}
% According to the manual this sets the digits to the regular arabics,
% while leaving the latin and greek letters untouched,
% this is intented, I want eulervm for maths letters.
\setmathfont(Digits,Latin,Greek)[%
  Arabic=Regular,
  Uppercase=Plain,
  Lowercase=Plain,
  Numbers={Lining,Proportional}
]{Calluna}
\setmonofont[
  Ligatures={NoRequired,NoCommon,NoContextual},
  Numbers={Lining,Monospaced}
]{FreeMono}

\usepackage[
  style=authoryear-comp,
  doi=true,
  url=true,
  sorting=nyvt,
  backend=biber,
]{biblatex}
\usepackage[hidelinks]{hyperref}
\addglobalbib{test2.bib}

\begin{document}

\section{Verify sans font}
The following line shows the normal verb command is unaffected:

{\scshape DOI:}\ \verb|10.1016/j.sedgeo.2010.04.015|

The following is a sentence to test the various fonts for digits with or without
\verb|\sisetup{detect-all}| or \verb|\setmathfont|.

1234567890, \(1234567890\),
\SI{1234567890}{\metre}, \(\SI{1234567890}{\metre}\),
\num{1234567890}, \(\num{1234567890}\).

\textcite{Hay2011} shows the problem with the DOI, I included this one because it
has an ugly mixture of letters and digits, showing the problem to its full extent.

\printbibliography
\end{document
}


Code: Select all  •  Open in writeLaTeX
@Article{Hay2011,
  Title                    = {Can humans force a return to a `Cretaceous' climate?},
  Author                   = {William W. Hay},
  Journaltitle             = {Sedimentary Geology},
  Year                     = {2011},
  Doi                      = {10.1016/j.sedgeo.2010.04.015},
  ISSN                     = {0037-0738},
  Language                 = {english},
  Note                     = {Causes of oxic - anoxic changes in Cretaceous marine environments and their implications for Earth systems },
  Number                   = {1-2},
  Pages                    = {5--26},
  Volume                   = {235},

  __markedentry            = {[hugo:1]},
  Journal                  = {Sedimentary Geology },
  Keywords                 = {Cretaceous},
  Owner                    = {hugo},
  Timestamp                = {2014.02.21}
}
Attachments
test2.pdf
(22.2 KiB) Downloaded 45 times
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
hugovdberg
 
Posts: 133
Joined: Sat Feb 25th, 2012
Location: 's-Hertogenbosch, Netherlands

Re: Specifications for Math Numerals

Postby hugovdberg on Sun Feb 23rd, 2014

A small update on the issue, for now I just set my monofont to Calluna, since in the current document I don't need listings or verbatim environments. However, if someone could point me in the right direction where to find the declarations that specify the typesetting of the DOI I would be very grateful.
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
hugovdberg
 
Posts: 133
Joined: Sat Feb 25th, 2012
Location: 's-Hertogenbosch, Netherlands

Re: Specifications for Math Numerals

Postby hugovdberg on Sun Mar 2nd, 2014

Since apparently nobody over here can help me I decided to cross-post it to TeX.sx, see my question over there: http://tex.stackexchange.com/questions/ ... references
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
hugovdberg
 
Posts: 133
Joined: Sat Feb 25th, 2012
Location: 's-Hertogenbosch, Netherlands

Re: Specifications for Math Numerals

Postby hugovdberg on Sun Mar 2nd, 2014

Thanks to egreg at TeX.se this problem has been solved, the code below is his solution to the problem.

Code: Select all  •  Open in writeLaTeX
\begin{filecontents}{test.bib}
@Article{Hay2011,
  Title                    = {Can humans force a return to a `Cretaceous' climate?},
  Author                   = {William W. Hay},
  Journaltitle             = {Sedimentary Geology},
  Year                     = {2011},
  Doi                      = {10.1016/j.sedgeo.2010.04.015},
  ISSN                     = {0037-0738},
  Language                 = {english},
  Note                     = {Causes of oxic - anoxic changes in Cretaceous marine environments and their implications for Earth systems },
  Number                   = {1-2},
  Pages                    = {5--26},
  Volume                   = {235},

  Journal                  = {Sedimentary Geology },
  Keywords                 = {Cretaceous},
}
\end{filecontents}

\documentclass{scrartcl}

\usepackage{amsfonts}
\usepackage{eulervm}

\usepackage{siunitx
}
\sisetup{
%  detect-all,
  math-rm=\mathlining,
}

\usepackage[no-math]{fontspec}
\setmainfont[Ligatures={Common,TeX},Numbers={OldStyle,Proportional}]{TeX Gyre Termes}
\newfontfamily{\liningmain}[Ligatures={Common,TeX},Numbers=Lining]{TeX Gyre Termes}
\setsansfont[Ligatures={Common,TeX},Numbers={Lining,Proportional}]{TeX Gyre Heros}
\setmonofont[Ligatures={NoRequired,NoCommon,NoContextual},Numbers={Lining,Monospaced}]{TeX Gyre Cursor
}

% A trick for extracting the family information
% which works independently of the chosen font
\begingroup
  \def\getfamily#1#2#3#4#5{#4}
  \edef\x{\endgroup
  \def\noexpand\liningdefault{\expandafter\expandafter\expandafter
    \getfamily\csname liningmain \endcsname}}\x

\DeclareSymbolFont{liningmath}{\encodingdefault}{\liningdefault}{m}{n}
\DeclareSymbolFontAlphabet{\mathlining}{liningmath}
\Umathcode`0="7 \symliningmath `0
\Umathcode`1="7 \symliningmath `1
\Umathcode`2="7 \symliningmath `2
\Umathcode`3="7 \symliningmath `3
\Umathcode`4="7 \symliningmath `4
\Umathcode`5="7 \symliningmath `5
\Umathcode`6="7 \symliningmath `6
\Umathcode`7="7 \symliningmath `7
\Umathcode`8="7 \symliningmath `8
\Umathcode`9="7 \symliningmath `9

\usepackage[
    style=authoryear-comp,
    doi=true,
    url=true,
    sorting=nyvt,
    backend=biber,
   
]{biblatex}
\usepackage[hidelinks]{hyperref}
\addglobalbib{test.bib}
\begin{document}

\section{Verify sans font}
The following line shows the normal verb command is unaffected:

DOI: \verb|10.1016/j.sedgeo.2010.04.015|

URL: \url{10.1016/j.sedgeo.2010.04.015}

This is a sentence to test the various fonts for digits with or without
\verb|\sisetup{detect-all}| or \verb|\setmathfont|.\\
No math: 1234567890,\\
Math:  \(1234567890\),\\
\verb|\SI| in text: \SI{1234567890}{\metre},\\
\verb|\SI| in math: \(\SI{1234567890}{\metre}\),\\
\verb|\num| in text: \num{1234567890},\\
\verb|\num| in math: \(\num{1234567890}\).

A test of math: $X=12$.

\begin{verbatim}
This is a test of numerals in the verbatim environment: 1234567890
\end{verbatim}

\textcite{Hay2011} shows the problem with the DOI, I included this one because it has an ugly mixture of letters and digits, showing the problem to its full extent.
\printbibliography
\end{document
}
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
hugovdberg
 
Posts: 133
Joined: Sat Feb 25th, 2012
Location: 's-Hertogenbosch, Netherlands

Re: Specifications for Math Numerals

Postby hugovdberg on Wed Mar 19th, 2014

Another update of this topic, since it later turned out this didn't solve the problem entirely. This solution works as it stands with TeX Gyre since that has lining figures as its default numerals (so named characters one, two, three, etc. for those familiar with OpenType fonts' internals), but Calluna, and the more regularly available EB Garamond have OldStyle figures by default. These are not loaded correctly without adding the option Renderer=Basic to the \liningmain font specification, but then the font is loaded correctly only about half the time, randomly changing between compilation runs. At the moment we suspect this is caused by a bug in luaotfload, so an issue has been opened at their GitHub, hopefully a fix will be available any time soon.
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
hugovdberg
 
Posts: 133
Joined: Sat Feb 25th, 2012
Location: 's-Hertogenbosch, Netherlands


Topic Tags

biblatexeulervmmathspecXeTeX

Return to Fonts & Character Sets

Who is online

Users browsing this forum: No registered users and 9 guests