2

I would like to know how to make the upright italics of the computer modern font the default choice on math mode for the whole document.

enter image description here

4 Answers 4

6

You define a new symbol font for the letters and reset their math codes.

\documentclass{article}

\DeclareSymbolFont{uiletters}{OT1}{cmr}{m}{ui}
\DeclareMathSymbol{a}{\mathalpha}{uiletters}{`a}
\DeclareMathSymbol{b}{\mathalpha}{uiletters}{`b}
\DeclareMathSymbol{c}{\mathalpha}{uiletters}{`c}
\DeclareMathSymbol{d}{\mathalpha}{uiletters}{`d}
\DeclareMathSymbol{e}{\mathalpha}{uiletters}{`e}
\DeclareMathSymbol{f}{\mathalpha}{uiletters}{`f}
\DeclareMathSymbol{g}{\mathalpha}{uiletters}{`g}
\DeclareMathSymbol{h}{\mathalpha}{uiletters}{`h}
\DeclareMathSymbol{i}{\mathalpha}{uiletters}{`i}
\DeclareMathSymbol{j}{\mathalpha}{uiletters}{`j}
\DeclareMathSymbol{k}{\mathalpha}{uiletters}{`k}
\DeclareMathSymbol{l}{\mathalpha}{uiletters}{`l}
\DeclareMathSymbol{m}{\mathalpha}{uiletters}{`m}
\DeclareMathSymbol{n}{\mathalpha}{uiletters}{`n}
\DeclareMathSymbol{o}{\mathalpha}{uiletters}{`o}
\DeclareMathSymbol{p}{\mathalpha}{uiletters}{`p}
\DeclareMathSymbol{q}{\mathalpha}{uiletters}{`q}
\DeclareMathSymbol{r}{\mathalpha}{uiletters}{`r}
\DeclareMathSymbol{s}{\mathalpha}{uiletters}{`s}
\DeclareMathSymbol{t}{\mathalpha}{uiletters}{`t}
\DeclareMathSymbol{u}{\mathalpha}{uiletters}{`u}
\DeclareMathSymbol{v}{\mathalpha}{uiletters}{`v}
\DeclareMathSymbol{w}{\mathalpha}{uiletters}{`w}
\DeclareMathSymbol{x}{\mathalpha}{uiletters}{`x}
\DeclareMathSymbol{y}{\mathalpha}{uiletters}{`y}
\DeclareMathSymbol{z}{\mathalpha}{uiletters}{`z}
\DeclareMathSymbol{A}{\mathalpha}{uiletters}{`A}
\DeclareMathSymbol{B}{\mathalpha}{uiletters}{`B}
\DeclareMathSymbol{C}{\mathalpha}{uiletters}{`C}
\DeclareMathSymbol{D}{\mathalpha}{uiletters}{`D}
\DeclareMathSymbol{E}{\mathalpha}{uiletters}{`E}
\DeclareMathSymbol{F}{\mathalpha}{uiletters}{`F}
\DeclareMathSymbol{G}{\mathalpha}{uiletters}{`G}
\DeclareMathSymbol{H}{\mathalpha}{uiletters}{`H}
\DeclareMathSymbol{I}{\mathalpha}{uiletters}{`I}
\DeclareMathSymbol{J}{\mathalpha}{uiletters}{`J}
\DeclareMathSymbol{K}{\mathalpha}{uiletters}{`K}
\DeclareMathSymbol{L}{\mathalpha}{uiletters}{`L}
\DeclareMathSymbol{M}{\mathalpha}{uiletters}{`M}
\DeclareMathSymbol{N}{\mathalpha}{uiletters}{`N}
\DeclareMathSymbol{O}{\mathalpha}{uiletters}{`O}
\DeclareMathSymbol{P}{\mathalpha}{uiletters}{`P}
\DeclareMathSymbol{Q}{\mathalpha}{uiletters}{`Q}
\DeclareMathSymbol{R}{\mathalpha}{uiletters}{`R}
\DeclareMathSymbol{S}{\mathalpha}{uiletters}{`S}
\DeclareMathSymbol{T}{\mathalpha}{uiletters}{`T}
\DeclareMathSymbol{U}{\mathalpha}{uiletters}{`U}
\DeclareMathSymbol{V}{\mathalpha}{uiletters}{`V}
\DeclareMathSymbol{W}{\mathalpha}{uiletters}{`W}
\DeclareMathSymbol{X}{\mathalpha}{uiletters}{`X}
\DeclareMathSymbol{Y}{\mathalpha}{uiletters}{`Y}
\DeclareMathSymbol{Z}{\mathalpha}{uiletters}{`Z}

\begin{document}

New setup: $ax+by=1$ $\hat{a}+\ddot{a}$

Standard setup $\mathnormal{ax+by}=1$ % for a check

\end{document}

enter image description here

The standard declarations are in fontmath.ltx and have the form

\DeclareMathSymbol{a}{\mathalpha}{letters}{`a}

The normal math italic letters are still available as \mathnormal{a}.

4

With unicode-math, you cab use the range= noption of \setmathfont to select upright italics. This requires LuaLaTeX or XeLaTeX. Here, for example, are Euler’s identities typeset with constants in upright italic:

\documentclass{article}
\usepackage{mathtools}
\usepackage{unicode-math}

\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont{Latin Modern Roman}[
  Scale=1.0]
\setmathfont{Latin Modern Math}
\setmathfont{CMU Serif Upright Italic}[
  range=up]

\newcommand\upi{\symup{i}}
\newcommand\upe{\symup{e}}

\begin{document}
\begin{align*}
  \upe^{\upi x} &= \cos{x} + \upi \sin{x} \\
  \upe^{\upi \uppi} + 1 &= 0
\end{align*}
\end{document}

Latin Modern Math/CMU Serif Upright Italic sample

To make math letters upright italic by default, pass unicode-math the math-style=upright option:

\usepackage[math-style=upright]{unicode-math}

Either way, you can switch back to slanted italics with \symit{x} and so on.

0
3

Just replace the letters symbol font with the upright italic variant (ui).

\documentclass{article}
\DeclareSymbolFont{letters}{OT1}{cmr}{m}{ui}
\begin{document}
$a^2 + b^2 = c^2$
\end{document}

enter image description here

The other answer has the benefit that you can get regular math italic back, whereas with this it is not possible.

0
0

After cross-referencing Davislor's answer with the unicode-math doc I think he made a typo. With reference to the figure attached, 'math-style = ISO' makes displayed math italic by default, not '...upright', which wouldn't make intuitive sense, anyway. For the reader, I've summarized the table below

  • ISO = latin/greek lowercase/uppercase italic
  • TeX = latin lowercase/uppercase + greek lowercase italic; greek uppercase upright
  • french = latin/greek lowercase italic; latin/greek uppercase upright
  • upright = latin/greek lowercase/uppercase upright

e.g. when you declare the package:

\RequirePackage[math-style=TeX]{unicode-math}%Should be loaded after any math-related packages

e.g. after you declare the package by appending preamble with command:

\unimathsetup{math-style=TeX} 

or e.g. inside the \setmathfont command:

\setmathfont[range = math-style=TeX,
SizeFeatures = {
  {Size = -6, Font = MinionMath-Tiny, Style = MathScriptScript},
  {Size = 6-8.4, Font = MinionMath-Capt, Style = MathScript},
  {Size = 8.4-13, Font = MinionMath-Regular},
}]{MinionMath-Regular}

Similar options exist for "sans-style" (sans serif), and "bold-style"; however, while 'math-style' affects everything (latin, greek sans) you can also set the individual math ranges to suit your needs. From unicode-math-luatex.sty, we have a complete demarcation for the various styles and their avaialable options:

\__um_keys_choices:nn {math-style}
  {
      {ISO} {
             \unimathsetup { nabla=upright, partial=italic,
              normal-style=ISO, bold-style=ISO, sans-style=italic }
            }
      {TeX} {
             \unimathsetup { nabla=upright, partial=italic,
               normal-style=TeX, bold-style=TeX, sans-style=upright }
            }
   {french} {
             \unimathsetup { nabla=upright, partial=upright,
               normal-style=french, bold-style=upright, sans-style=upright }
            }
  {upright} {
             \unimathsetup { nabla=upright, partial=upright,
               normal-style=upright, bold-style=upright, sans-style=upright }
            }
  {literal} {
             \unimathsetup { colon=literal, nabla=literal, partial=literal,
               normal-style=literal, bold-style=literal, sans-style=literal }
            }
  }
\__um_keys_choices:nn {bold-style}
  {
      {ISO} {
             \bool_gset_false:N \g__um_bfliteral_bool
             \bool_gset_false:N \g__um_bfupGreek_bool
             \bool_gset_false:N \g__um_bfupgreek_bool
             \bool_gset_false:N \g__um_bfupLatin_bool
             \bool_gset_false:N \g__um_bfuplatin_bool
            }
      {TeX} {
             \bool_gset_false:N \g__um_bfliteral_bool
             \bool_gset_true:N  \g__um_bfupGreek_bool
             \bool_gset_false:N \g__um_bfupgreek_bool
             \bool_gset_true:N  \g__um_bfupLatin_bool
             \bool_gset_true:N  \g__um_bfuplatin_bool
            }
  {upright} {
             \bool_gset_false:N \g__um_bfliteral_bool
             \bool_gset_true:N  \g__um_bfupGreek_bool
             \bool_gset_true:N  \g__um_bfupgreek_bool
             \bool_gset_true:N  \g__um_bfupLatin_bool
             \bool_gset_true:N  \g__um_bfuplatin_bool
            }
  {literal} {
             \bool_gset_true:N  \g__um_bfliteral_bool
            }
  }
\__um_keys_choices:nn {sans-style}
  {
    {italic}  { \bool_gset_false:N \g__um_upsans_bool    }
    {upright} { \bool_gset_true:N  \g__um_upsans_bool    }
    {literal} { \bool_gset_true:N  \g__um_sfliteral_bool }
  }
\__um_keys_choices:nn {nabla}
  {
    {upright} {
                \bool_gset_false:N \g__um_literal_Nabla_bool
                \bool_gset_true:N  \g__um_upNabla_bool
              }
    {italic}  {
                \bool_gset_false:N \g__um_literal_Nabla_bool
                \bool_gset_false:N \g__um_upNabla_bool
              }
    {literal} {
                \bool_gset_true:N  \g__um_literal_Nabla_bool
              }
  }
\__um_keys_choices:nn {partial}
  {
   {upright} {
               \bool_gset_false:N \g__um_literal_partial_bool
               \bool_gset_true:N  \g__um_uppartial_bool
             }
   {italic}  {
               \bool_gset_false:N \g__um_literal_partial_bool
               \bool_gset_false:N \g__um_uppartial_bool
             }
   {literal} {
               \bool_gset_true:N  \g__um_literal_partial_bool
             }
  }

In short you can adjust the styles of the \partial, \nabla commands, serif math, upright math, bold-math and so on; refer to the above code to see how.

Table 5: Effects of the math-style package option in 'unicode-math' package

You must log in to answer this question.

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