5

I am handling a text which is natively written in a proprietary LaTeX documentclass which implements Dante Monotype fontface. In this text there is a lot of maths and I would say that it works, overall, even if I would not advise in particular Dante font for maths applications.

Even exponents ($e^{x^2}$) are, say, well proportioned to my eye while what I do not like at all are fractions. As in the following picture:

image

the fraction circled in red, as well as the following ones, has numerator and denominator that are very far from the fraction bar.

How can I improve this in particular? Any package related to fractions may work currently with this font? Any command similar to \dfrac or \tfrac may help decreasing (rather than increasing) the total height of the fractions?

No further solutions come to my mind to fix such "length".


Addendum:

I have MikTeX 2.9 on Windows 7 OS. The editors I use are TeXstudio and TeXnicCenter and I compile with pdfLaTeX. The behaviour of the fractions is the same when using TeXshop on Mac OS. Thank you.

The code for the picture above is:

$$y_0(t)=1$$
$$y_1(t)=1+\int^t_0 \mt\,\md\mt=1+\frac{t^2}{2}$$
$$y_2(t)=1+\int^t_0 \mt\left(1+\frac{\mt^2}{2}\right)\md\mt=1+\frac{t^2}{2}+\frac{t^4}{8}$$
\vspace{1pt}
$$\vdots$$
\vspace{1pt}
$$y_n(t)=1+\int^t_0 \mt\,y_{n-1}(\mt)\,\md\mt=1+\frac{t^2}{2}+\frac{1}{2!}\left(\frac{t^2}{2}\right)^2+\ldots+\frac{1}{n!}\left(\frac{t^2}{2}\right)^n$$

where \md and \mt were defined in my preamble. Thank you.


Addendum (2):

I appreciated both the answers posted so far and I tried to define a newcommand as in lines 2 to 15 of the code by Steven B. (I preferred this approach because I never put my hands on LuaLaTeX before and this was meant to be "just fine tuning"). Furthermore I tried all of the following three:

\renewcommand{\frac}[2]{\displaystyle{\frac{\lower2pt\hbox{#1}}{\raise2pt\hbox{#2}}}}

and:

\renewcommand{\frac}[2]{\dfrac{\lower2pt\hbox{#1}}{\raise2pt\hbox{#2}}}

or:

\newcommand\newfrac[2]{\frac{\lower2pt\hbox{#1}}{\raise2pt\hbox{#2}}}

but all of these four candidate solutions generated several errors in my system (class). Do these three lines of me suggest something useful?

I'll post updates.

12
  • 3
    Please provide more information about the LaTeX format you use (pdfLaTeX?, LuaLaTeX?, ConTeXt?, ...) and the way the math font has been set up. A self-contained example with code that shows how the fraction expression was generated would be welcome.
    – Mico
    May 8, 2014 at 12:55
  • 2
    It seems that some font dimensions in the math symbol font are set to a too high value; the relevant font dimensions are 8 to 12 (see Appendix G in the TeXbook).
    – egreg
    May 8, 2014 at 13:03
  • 2
    You should add a minimal working example we can compile, to see what you are using. Even if we don't have those fonts, at least see the code would help.
    – Manuel
    May 8, 2014 at 13:09
  • 3
    Lining figures would definitely help e.g. the 2 would at least be no further under the line than the 8. But if you can't show us the relevant part of the code, nobody can say more than egreg and Manuel have already said. The only way to really fix it is to fix those definitions. Anything else is likely to make things worse rather than better, in all probability. Do the d and t in dt, for example, come form different fonts or is that an artefact of the image?
    – cfr
    May 8, 2014 at 22:24
  • 3
    Well we don't know anything about how the fonts are set up. If you cannot share any part of the class file and all of the font configuration is done there or in associated proprietary files, this may not be a legal option. But then you have to figure that code out for yourself to adjust the font dimensions and ensure lining figures are used. We can't say more than that that is what you need to do without access to the code since obviously the details depend on that code.
    – cfr
    May 8, 2014 at 22:47

2 Answers 2

4

I don't have access to your font, but (as indicated in my comment), my answer at A special fraction macro with raised fraction bar can address your issue. Here, I create it as \newfrac.

I modified the dimensions from the cited answer to further squeeze the fractions together, for demonstration purposes. The optional arguments for \stackunder and \stackon are the gap distances to adjust to suit your needs. This MWE, of course, is using the CM fonts.

\documentclass{article}
\usepackage{stackengine}
\usepackage{ifthen}
\newlength\testwida
\newlength\testwidb
\newlength\mywidth
\newcommand\newfrac[2]{%
  \setlength\testwida{\widthof{$#1$}}%
  \setlength\testwidb{\widthof{$#2$}}%
  \ifthenelse{\lengthtest{\testwida>\testwidb}}%
    {\mywidth=\testwida}%
    {\mywidth=\testwidb}%
  \raisebox{.5ex}{%
    \stackunder[2pt]{\stackon[2pt]{\rule{\mywidth}{.4pt}}{$#1$}}{$#2$}}%
}
\def\mt{\mathbf{t}}
\def\md{\mathbf{d}}
%\let\newfrac\frac% UNCOMMENT TO SEE ORIGINAL \frac VERSION
\begin{document}
$$y_0(t)=1$$
$$y_1(t)=1+\int^t_0 \mt\,\md\mt=1+\newfrac{t^2}{2}$$
$$y_2(t)=1+\int^t_0 \mt\left(1+\newfrac{\mt^2}{2}\right)\md\mt=1+\newfrac{t^2}{2}+\newfrac{t^4}{8}$$
\vspace{1pt}
$$\vdots$$
\vspace{1pt}
$$y_n(t)=1+\int^t_0 \mt\,y_{n-1}(\mt)\,\md\mt=1+\newfrac{t^2}{2}+\newfrac{1}{2!}\left(\newfrac{t^2}{2}\right)^2+\ldots+\newfrac{1}{n!}\left(\newfrac{t^2}{2}\right)^n$$

\end{document}

enter image description here

For comparison, here is the original \frac version.

enter image description here

2
5

The following is primarily an attempt to replicate your screenshot, which is based on a proprietary setup, with non-proprietary tools. Hopefully, the answer also provides a usable suggestion for how the issue of the excessive distance of the numerator and denominator terms from the fraction bars may be addressed.

My code uses LuaLaTeX as I don't have access to a non-Opentype version of the Dante font; specifically, I use Dante MT Std. I also use the Cambria Math math font, as I find it to be a much better match to Dante than, say, TeX Gyre Pagella Math is. The match isn't perfect; Cambria Math is simply the best match I was able to come up with. Fortunately, the match can be improved considerably by using various \setmathfont directives to instruct the system to use Dante MT glyphs for all digits and letters as well as for various symbols.

Note that the numerator and denominator terms are not nearly as far above and below the fraction bars as they are in your proprietary setup.

Summing up: Is switching from pdfLaTeX to LuaLaTeX and using the Cambria Math math font family -- along with using either Dante MT Std or Dante MT Pro as the text font -- an option for you?

enter image description here

% !TEX TS-program = lualatex
\documentclass{article}

% Set text font
\usepackage[no-math]{fontspec}
\setmainfont[Numbers=OldStyle]{Dante MT Std} 

\usepackage{amsmath} % for 'gather*' environment

% Set default math font
\usepackage{unicode-math}
\setmathfont[Scale=MatchLowercase]{Cambria Math}

% Use Dante MT for numerals, all letters, and various symbols
\setmathfont[range={"0030-"0039},Numbers=OldStyle]{Dante MT Std}
\setmathfont[range=\mathrm]{Dante MT Std}
\setmathfont[range=\mathit]{Dante MT Std Italic}
\setmathfont[range=\mathbfup]{Dante MT Std Bold}
\setmathfont[range=\mathbfit]{Dante MT Std Bold Italic}
\setmathfont[range={"0025,"002A-"002F,
     "003A-"003F,"005B-"005D,"007B-"007D,
     "03A9,"00B0-"00B7,"00BC-"00BE,"00D7,
     "00F7,"03A9,"03BC,"03C0,"2153,"2154,
     "215B-"215E,"2202,"2206,"2212,"2215,
     "2219,"221E,"2248,"2260,"2264,"2265}]{Dante MT Std}

% A couple of user-defined shorthand macros
\newcommand{\md}{\mathrm{d}}
\newcommand{\mt}{\mathbf{t}}

\begin{document}
\begin{gather*}
y_0(t)=1\\
y_1(t)=1+\int^t_0 \mt\,\md\mt=1+\frac{t^2}{2}\\
y_2(t)=1+\int^t_0 \mt\left(1+\frac{\mt^2}{2}\right)\md\mt=1+\frac{t^2}{2}+\frac{t^4}{8}\\
\vdots \\
y_n(t)=1+\int^t_0 \mt\,y_{n-1}(\mt)\,\md\mt=
1+\frac{t^2}{2}+\frac{1}{2!}\left(\frac{t^2}{2}\right)^{\!2}+\dots+
\frac{1}{n!}\left(\frac{t^2}{2}\right)^{\!n}
\end{gather*}
\end{document}

Addendum: Speaking for myself, I find the use of oldstyle numbers in mathematics rather questionable. Here's the look that results from omitting the Numbers=OldStyle option in the second \setmathfont directive of the MWE. (You are, of course, free to decide for yourself if you prefer oldstyle or lining numeral in mathematics.)

enter image description here

You must log in to answer this question.

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