3

Want to write a summation symbol in the similar form in the attachment. Please advice.

enter image description here

  • 3
    Um, \sum_k^n \begin{matrix}0&1\\1&1\end{pmatrix} if you're using amsmath. –  May 03 '18 at 02:55

3 Answers3

8
\documentclass[]{article}

\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{calc}
\newlength{\depthofsumsign}
\setlength{\depthofsumsign}{\depthof{$\sum$}}
\newlength{\totalheightofsumsign}
\newlength{\heightanddepthofargument}

% https://tex.stackexchange.com/questions/22773/making-a-big-summation-sign
\newcommand{\nsum}[1][1.4]{
  \mathop{%
    \raisebox
    {-#1\depthofsumsign+1\depthofsumsign}
    {\scalebox
      {#1}
      {$\displaystyle\sum$}%
    }
  }
}

\begin{document}

\[
\sum_k^n \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} = \nsum[2]_k^n \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}
\]

\end{document}

enter image description here

caverac
  • 7,931
  • 2
  • 15
  • 31
7

Here are two further solutions:

  • Instead of enlarging the summation symbol, shrink the matrix, by using a psmallmatrix environment instead of a pmatrix environment.

  • Load the relsize package and employ \larger instructions to enlarge the size of the \sum symbol. In the code below, I create a macro called \bigsum. By default, the applies \larger three times, for a total magnification of (1.2)^3=1.728. (Doubling the \sum symbols seems excessive to me...)

The following code also re-implements the \nsum macro shown in @caverac's answer, so that TeX does all the hard work, mainly via a \vcenter instruction. This seems nicer than performing several length calculations and then employing a \raisebox instruction.

enter image description here

\documentclass{article}

\usepackage{mathtools} % for 'pmatrix' environment
\usepackage{relsize}   % for '\larger' macro
\usepackage{graphicx}  % for '\scalebox' macro

\newcommand\nums{0 & 1 \\ 1 & 0} % handy shortcut macro

% default enlargement applied by `\bigsum`: 3 steps of 1.2 
\newcommand\bigsum[1][3]{\mathop{\vcenter{\hbox{%
   \larger[#1]{$\displaystyle\sum$}}}}}

% reimplementation of '\nsum': make TeX do all the hard work
\newcommand{\nsum}[1][1.44]{\mathop{\vcenter{\hbox{%   % 1.44=(1.2)^2
   \scalebox{#1}{$\displaystyle\sum$}}}}}

\begin{document}
\[
  \sum_k^n    \begin{psmallmatrix} \nums \end{psmallmatrix}
= \sum_k^n         \begin{pmatrix} \nums \end{pmatrix}
= \bigsum_k^n      \begin{pmatrix} \nums \end{pmatrix}
= \nsum[1.728]_k^n \begin{pmatrix} \nums \end{pmatrix}  % 1.728=(1.2)^3
\]

\end{document}
Mico
  • 506,678
  • This answer is better! \bigsum! – M. Logic May 03 '18 at 09:07
  • @Kuttens -- Thanks! :-) What I like about the \bigsum approach, as opposed to the nsum approach, is that it gives an explicit nod to the typographic principle that when scaling objects and symbols, it's rarely a good idea to use arbitrary scaling factors. Given that many TeX fonts are organized around geometric progressions with a scaling factor of 1.2, it's usually a good starting point to choose powers of 1.2 as well. – Mico May 03 '18 at 09:44
  • @Mico I'm interested to the organization of fonts around the geometric progressions with a scaling factor of two. I never heard of this thing. Have you perhaps some reference? – gvgramazio May 03 '18 at 09:55
  • @giusva - In LaTeX, if the document font size is 10pt, \large is 20% larger than \normalsize, \Large is 20% larger than \large, \LARGE is 20% larger than \Large, etc. The 20% steps are not unique to LaTeX. Why 20% and not, say, 15% or 25%? I've never found an explicit reference on this topic; however, I suspect that 20% came about in part because 1.2 is quite close to the 4th root of 2. (1.189^4=2) Since the factor 2 has special significance in many parts of Western culture, incl. music, I think it's not surprising that some typographers chose 1.2 as a basic scaling factor. – Mico May 03 '18 at 10:52
  • @giusva - Oddly, when it comes to math typesetting and the choice of scaling factors for subscript- and subsubscript-mode material, a widely used scaling factor (incl. in TeX) is 0.7, not 1/1.2=0.833: \scriptsize corresponds to 0.7*\normalsize, and \scriptscriptstyle (text-mode equivalent: \tiny) is 0.5\normalsize: 0.7*0.7=0.49\approx 0.5. I have no idea if Knuth himself has ever written about how he came up with the 1.2 factor for upscaling in text mode and the 0.7 factor for downscaling in math mode. – Mico May 03 '18 at 11:00
  • 1
    If you are intersted in this topic, I've asked a question with this purpouse in mind. – gvgramazio May 03 '18 at 11:18
1

In unicode-math, you can load another copy of a math font with the scale= parameter to increase the size of a math symbol. This would be wrapped in several different macros to insert the glyph from text mode and treat it as a math operator with limits above and below. Based on suggestions in the comments, this also centers the symbol vertically and sets the font to Cambria Math, although scaled Cambria Math gives a summation symbol that’s thicker than you wanted.

\documentclass[varwidth, preview]{standalone}

\usepackage{amsmath}
\usepackage{unicode-math}

\setmainfont{Cambria}
\setmathfont{Cambria Math}
\newfontface\bigmath{Cambria Math}[Scale=3.0]

\newcommand\bigsum{\mathop{\vcenter{\hbox{\bigmath ∑}}}\limits}

\begin{document}
\(
  \bigsum_k^n \begin{pmatrix}0&1\\1&1\end{pmatrix}
\)
\end{document}

Cambria Math Sample

You could vary the scale= parameter using the font features commands from fontspec, although if you want a specific height, you probably want a \resizebox from graphicx.

Davislor
  • 44,045
  • 2
    Note that in your current solution, the large summation symbol is placed on the (text) baseline instead of being centered vertically on the mathline. One could employ a \vcenter{\hbox{...}} wrapper in order to get the (vertical) centering right. – Mico May 03 '18 at 09:41
  • 1
    In case my previous comment was too cryptic: Give \newcommand\bigsum{\mathop{\vcenter{\hbox{\bigmath ∑}}}\limits} a try. :-) – Mico May 03 '18 at 09:48
  • 1
    Now that you use unicode-math, you could just use the font in the question: Cambria Math – Manuel May 03 '18 at 09:58
  • @Mico Good idea! – Davislor May 03 '18 at 17:36