Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabular figures #10

Closed
RuixiZhang42 opened this issue Aug 1, 2018 · 11 comments
Closed

Tabular figures #10

RuixiZhang42 opened this issue Aug 1, 2018 · 11 comments
Labels
enhancement New feature or request

Comments

@RuixiZhang42
Copy link

Currently Fira Math uses lining but proportional figures, as illustrated in the following example.

% Compile with XeLaTeX or LuaLaTeX
\documentclass{article}
% Fira Sans and Fira Math
\usepackage[sfdefault,lining,tabular]{FiraSans}
\usepackage[mathrm=sym]{unicode-math}
\setmathfont{Fira Math}
% newtx
%\usepackage{newtxtext}
%\usepackage{newtxmath}

\newcommand*{\measurewidth}[1]{{%
  $#1$: \setbox0=\hbox{$#1$}\the\wd0\relax}}

\begin{document}
Math: $2018$.\par
Text: 2018.\par
\measurewidth{0}\par
\measurewidth{1}\par
\measurewidth{2}\par
\measurewidth{3}\par
\measurewidth{4}\par
\measurewidth{5}\par
\measurewidth{6}\par
\measurewidth{7}\par
\measurewidth{8}\par
\measurewidth{9}
\end{document}

Although proportional figures are appropriate in text, tabular figures are more suitable for price lists, stock listings and sums in mathematics textbooks, etc. Try the newtxtext and newtxmath packages for a comparison. In general, proportional figures lead to misalignment within tables.

Note that the lining and tabular options of FiraSans causes text figures to be taken from Fira Mono, which is not desired.

I was wondering if, by default, math figures can be made “mono-spaced” by adjusting their bounding boxes; that is, using Fira Sans figures but with fixed glyph width.

@stone-zeng
Copy link
Collaborator

I don't think that using mono-spaced (or tabular) numbers in math mode is a good choice. But I can still add this feature, as well as the old style and tabular old style numbers.

By the way, FiraSans already has tabular numbers, and it looks like FiraMono (e.g. 1 has a serif), but not Fira Mono.

@stone-zeng stone-zeng added the enhancement New feature or request label Aug 2, 2018
@sunnyssk
Copy link

sunnyssk commented Aug 2, 2018

As far as I notice, in MS Word, other math fonts like Latin Modern Math, Libertinus Math and Cambria Math all use monospaced numbers by default (in and out of math mode), and for LM Math the width is of exactly 1 \ensp, which makes them easy to be aligned in column. I do not know the details of the mapping, or whether it has something to do with the serif font style, but it seems not a bad idea to have monospaced numbers in math font by default?

@hvoss49
Copy link

hvoss49 commented Aug 2, 2018 via email

@stone-zeng
Copy link
Collaborator

Have checked several fonts. I will make the numbers to be mono-spaced by default then.

@RuixiZhang42
Copy link
Author

RuixiZhang42 commented Aug 2, 2018

Thank you for all the positive comments!

To clarify my original post, I was suggesting adjusting the bounding width (not the font). Right now, text tabular figures (old style and lining) are Fira Mono, while text proportional figures (old style and lining) are Fira Sans. IMHO, making mono-spaced math figures by changing figures to Fira Mono look-alike is a bad idea (e.g., the serif 1 in a sans font). The glyphs should stay the same except for their widths.

@stone-zeng
Copy link
Collaborator

Still I need to point out that, the tabular numbers in Fira Sans do look like that in Fira Mono, but they are actually not exactly identical (you may check the paths and points' position). Whether 1 has serif or not and whether 4 is closed or open, are both determined by the original design of Fira Sans.

You may try the following code, and I never use Fira Mono here:

\documentclass{article}
\usepackage{fontspec}
\setsansfont{FiraSans-Regular.otf}

\begin{document}
\sffamily

\verb|default   | 0123456789 \par
\verb|lnum      | {\addfontfeature{Numbers=Lining} 0123456789} \par
\verb|onum      | {\addfontfeature{Numbers=OldStyle} 0123456789} \par
\verb|pnum      | {\addfontfeature{Numbers=Proportional} 0123456789} \par
\verb|tnum      | {\addfontfeature{Numbers=Monospaced} 0123456789} \par
\verb|lnum+pnum | {\addfontfeature{Numbers=Lining,Numbers=Proportional} 0123456789} \par
\verb|onum+pnum | {\addfontfeature{Numbers=OldStyle,Numbers=Proportional} 0123456789} \par
\verb|lnum+tnum | {\addfontfeature{Numbers=Lining,Numbers=Monospaced} 0123456789} \par
\verb|onum+tnum | {\addfontfeature{Numbers=OldStyle,Numbers=Monospaced} 0123456789}

\end{document}

image

Anyway, I can add both serif/sans serif 1 and closed/open 4 as different stylistic sets.

@stone-zeng
Copy link
Collaborator

I hope this is what you want:

image

The code can be found in test/font-test.tex.

@RuixiZhang42
Copy link
Author

This is more than perfect! I noticed the extra effort made to guarantee that bold figures share the same width with the regular ones.

Is the decimal point . (or , in some other countries) in regular and bold weights of the same width too?

@stone-zeng
Copy link
Collaborator

In Fira Math, period and . comma , have the same width (240/1000 em), but not the same as digits (560/1000 em). They do not have bold version (I mean in fira-math-regular).

In XITS Math and Latin Modern Math, the width of . and , is exactly one half of the digits, but I think it's more likely to be a design, rather than a convention or a standard.

@RuixiZhang42
Copy link
Author

Thank you for the detailed explanation. I absolutely agree that it’s a matter of design. It doesn’t matter if . and , are of the same width with the digits, as long as they are consistent. You may want to make bold . and bold , to be 240/1000 em wide (in future releases like FiraMath-Bold).

@bwiernik
Copy link
Contributor

I did not check the widths, but it would also be nice if mid space (U+2005) [or thin space (U+2009)] and narrow no-break space (U+202F) were also the same width and . and , to ensure consistency if the SI-standard space is used as a digit-group separator rather than . or ,.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants