1

I'm looking for a way to reduce the default size of plus and minus signs that appear as indices.

Here is a dirty tex sample:

One has the following commutation relations:
\[  \left\{ \, \begin{aligned}
    \partial_k \, \partial_p &= \partial_{p-1} \, \partial_k  
        & \mathrm{if} & \quad k < p \\
    \partial_k \, \partial_p &= \partial_p \, \partial_{k+1}  
        & \mathrm{if} & \quad k \geq p
\end{aligned} \right. \]

which renders as:

enter image description here

My problem is that + and - signs take way more space than the p and k indices. I would be greatly relieved if I could get something as good looking as this previous code monospace font.

Does anyone know how I could achieve this?

A full MWE:

\documentclass{article}
\begin{document}
\[ \partial_k \partial_p = \partial_{p-1}\partial_k
    \quad \mathrm{if} \quad k < p \]
\[ \partial_k \partial_p = \partial_p\partial_{k+1}
    \quad \mathrm{if} \quad k \geq p \]
\end{document}
4
  • 2
    Welcome to TeX.SX! Could you make your code compilable for everyone? See minimal working example (MWE). Maybe related Rescaling a math symbol? or How do I make the minus symbol less heavy (or plus more so)
    – Bobyandbob
    Aug 20, 2017 at 13:32
  • Incidentally, what do you mean by "this previous code monospace font"? For sure, I see no monospaced font in the screenshot you posted.
    – Mico
    Aug 20, 2017 at 14:45
  • That's the right size for the CM fonts. I'm not sure \, is good there.
    – egreg
    Aug 20, 2017 at 19:51
  • @Mico I was referring to the code sample not the screenshot^^
    – shevket
    Aug 23, 2017 at 16:45

1 Answer 1

1

The following, LuaLaTeX-based solution may be of interest to you. The solution consists of (a) a Lua function, called smaller_plus_minus, which scans all input lines for occurrences of - and + located inside a subscript or superscript group and (if found) replaces these occurrences with smaller versions of the symbols in question and (b) LaTeX macros to activate and deactivate the Lua function. Multiple instances of - or + per subscript or superscript group are permitted.

The main working assumption made here is that the subscript and superscript material is always delimited by a matching pair of curly braces ({ and }), e.g., a_{p-q} and b^{u+v}. The Lua function will not operate on instances of a_- or b^+. I trust this isn't much of a constraint.

The Lua function is currently set to operate on all input, including material that may be inside verbatim-like environments. That's presumably undesirable. If your document contains verbatim-like material, I suggest you run \DeactivateSmallerPlusMinus before the start of the material in question -- and run \ActivateSmallerPlusMinus after the end of the verbatim-like material.

enter image description here

Honestly, I don't think it's a great idea to reduce the sizes of + and - in subscript and superscript material.

% !TeX program = lualatex
\documentclass{article}
\usepackage{mathtools} % for "dcases" env.

%% Lua-side code
\usepackage{luacode}
%% Lua-side code
\usepackage{luacode}
\begin{luacode}
local function sub_to_tiny ( u , v )
  return u .. v:gsub ( "[%+%-]" , "\\mathrel{\\vcenter{\\hbox{\\tiny$%0$}}}" ) 
end
function smaller_plus_minus ( s )
  return s:gsub ( "([_%^])%s-(%b{})" , sub_to_tiny ) 
end
\end{luacode}

%% LaTeX-side code
\newcommand\ActivateSmallerPlusMinus{\directlua{luatexbase.add_to_callback 
    ( "process_input_buffer", smaller_plus_minus, "smaller_plus_minus" )}}
\newcommand\DeactivateSmallerPlusMinus{\directlua{luatexbase.remove_from_callback 
    ( "process_input_buffer", "smaller_plus_minus" )}}
\AtBeginDocument{\ActivateSmallerPlusMinus} % activate lua function by default

\begin{document}
$\displaystyle\begin{dcases}
    \partial_k\partial_p = \partial_{p-1}\partial_k & \text{if $k < p$} \\
    \partial_k\partial_p = \partial_p\partial_{k+1} & \text{if $k \geq p$}
\end{dcases}$

\medskip
$\partial_{p-q}$, $\partial_{k+\ell}$, $a_{--}$, $b^{++}$
vs.\par
\DeactivateSmallerPlusMinus % remove lua function from callback
$\partial_{p-q}$, $\partial_{k+\ell}$, $a_{--}$, $b^{++}$
\end{document} 
2
  • If you have inline verbatim-like directives in your code, I suggest you take a look at this answer to this recent query. Just replace all references to the function insert_thinspaces with references to smaller_plus_minus, and you should be all set. :-)
    – Mico
    Aug 20, 2017 at 20:34
  • 1
    Thanks a lot, I didn't know about luacode it seems powerful!
    – shevket
    Aug 23, 2017 at 16:43

You must log in to answer this question.

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