3

Basically, I want to definite a flalign environment where all the math uses mathsf by default.

I can't just wrap the whole thing in a mathsf command because there might be line breaks and & separators that break things.

Is there a version of mathsf that works like \color where it sets the font style for the entire block, instead of just for the argument?

1 Answer 1

3

You can use sansmath, supplementing it with a sans serif font for large operators.

\documentclass{article}
\usepackage{amsmath}
\usepackage{sansmath}

\SetSymbolFont{largesymbols}{sans}{OMX}{iwona}{m}{n}

\begin{document}

\sansmath

\begin{flalign}
A&=B & C&=D & u&=v \\
x&=\sum_{i=1}^n a_i & y&=M\otimes N & z&=U^v & x\ne z
\end{flalign}

\unsansmath

\begin{flalign}
A&=B & C&=D & u&=v \\
x&=\sum_{i=1}^n a_i & y&=M\otimes N & z&=U^v & x\ne z
\end{flalign}

\end{document}

enter image description here

4
  • @user94293 Yes, of course.
    – egreg
    Commented Jan 7, 2023 at 13:24
  • That looks great, except it makes everything italics in the sans-serif font. Is it possible to disable that? Commented Jan 7, 2023 at 16:13
  • @jmite You may want to add \SetMathAlphabet{\mathsfsl}{sans}{\sansmathencoding}{\sfdefault}{m}{n}
    – egreg
    Commented Jan 7, 2023 at 16:33
  • perfect! Two more questions. (1) it seems like right now parentheses symbols aren't being rendered at all, is there a way to fix that? (2) Currently, if I do \mathrm{...} inside the sansmath environment, it just ignores it and prints it as sans. Is there a way to have sans as the default for the environment, but to still be able to use all the normal font commands in the sans environment? Commented Jan 7, 2023 at 16:58

You must log in to answer this question.

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