Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to create a new "big operator", by which I mean something like the Σ character used for summations.

enter image description here

I know about the \DeclareMathOperator* command, which creates an operator whose superscripts and subscripts are written directly above and below the operator. Here is an example of that.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\DeclareMathOperator*{\foo}{\maltese}

\begin{document}
\[
\foo_{i=3}^{6}(f^2(i))
\]
\end{document}

enter image description here

However, I would like to make my operator "big". I tried this:

\DeclareMathOperator*{\foo}{\text{\Large $\maltese$}}

enter image description here

but that feels like a bit of a hack. Besides, the operator is too high, and needs moving down a tad to align it properly with its operand. So, what's the proper way to do this? How, for instance, is the \sum operator defined?

share|improve this question
2  
To answer your last question, \show\sum reveals that the sigma symbol is stored in \mathchar"1350. –  Jubobs May 28 '13 at 12:43
1  
Take also a look at the mathlarger command in the relsize package (see tex.stackexchange.com/questions/7462/… ) –  boumol May 28 '13 at 14:16

3 Answers 3

up vote 19 down vote accepted

The scalerel package allows you to scale a symbol to the size (and vertical positioning) of another symbol. So in this case, I define \foo to scale \maltese to the size of \sum. Thus, it piggybacks its sizing off the well defined behavior of \sum.

It wasn't clear to me if the questioner wanted to keep the maltese cross the same size in all operations. However, if that is the case, I can redefine the \foo operator as \barr in order to keep the size equal to that of a textstyle summation sign. The example below shows instances of \foo as well as \barr in both displaystyle and inline.

Edit: Use scalerel version 1.5 or later to ensure that scalerel captures the current math style.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\DeclareMathOperator*{\foo}{\scalerel*{\maltese}{\sum}}
\DeclareMathOperator*{\barr}{\scalerel*{\maltese}{\textstyle\sum}}
\usepackage{scalerel}

\begin{document}
\[
\foo_{i=3}^{6}(f^2(i))
\]

This is inline: \(\foo_{i=3}^{6}(f^2(i)) \)

\[
\barr_{i=3}^{6}(f^2(i))
\]

This is inline: \(\barr_{i=3}^{6}(f^2(i)) \)
\end{document} 

enter image description here

share|improve this answer
    
Very nice application of \scalerel! –  Hendrik Vogt May 28 '13 at 16:35
    
(+1 after clarifying edit:-) –  David Carlisle May 28 '13 at 18:23

Operators such as \sum are not defined with \DeclareMathOperator that should be used (with or without a *) for “textual” operators.

The definition of \sum is

\DeclareMathSymbol{\sum}{\mathop}{largesymbols}{"50}

that becomes, internally,

\mathchardef\sum="1350

The macro \DeclareMathOperator uses \mathop, which has a strange property: if its argument turns out to be a single character, it will be raised or lowered so that it becomes centered with respect to the math axis (where fraction lines are typeset).

Since there is no “big version“ of \maltese, one has to resort to other methods for building a good symbol from it. Indeed, one of the math font properties is that some characters have instructions telling where to find “big versions” for it.

TeX has a workaround, which is called \mathchoice; so you can do it with something like:

\documentclass[fleqn]{article}
\usepackage{amssymb}

\newcommand{\bigmaltese}{%
  \mathop{ % we want it to be an operator
    \mathchoice{\dobigmaltese\Large}
               {\dobigmaltese\large}
               {\dobigmaltese\normalsize}
               {\dobigmaltese\small}
    }\displaylimits % not necessary, but added for clarity
}

\newcommand{\dobigmaltese}[1]{%
  \vcenter{#1\kern.2ex\hbox{$\maltese$}\kern.2ex}}

\begin{document}
Here's in text, $\bigmaltese_{i=1}^n x_i$, next in display
\[
\bigmaltese_{i=1}^n x_i
\]
\end{document}

We define for each style what we want. The \dobigmaltese command builds a box centered with respect to the formula axis. I've added some room above and below. This won't change sizes when the overall font size changes; a slightly different method would be necessary.

enter image description here

share|improve this answer

If you execute

tftopl cmex10.tfm > cmex10.pl

and look at character octal 120 ( = hex 50) you see

(CHARACTER O 120
   (CHARWD R 1.055559)
   (CHARDP R 1.000013)
   (NEXTLARGER O 130)
   )

which tells you (or at least, tells TeX) that there is a larger version of the character at position octal 130.

share|improve this answer
1  
David, how do you know that character octal 120 corresponds to uppercase sigma? –  Jubobs May 28 '13 at 12:50
4  
@Jubobs because you helpfully told me that in your comment, so it saved me looking it up:-) the last two (hex) digits of the mathchar you quoted are 50. Note that this is a summation sign not a sigma. –  David Carlisle May 28 '13 at 12:51
    
I see :) Thanks. –  Jubobs May 28 '13 at 12:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.