3

I want to write something like this
Need to replicate

I have tried something like (requires relsize package for using \larger[]{})

$$\mathop{\mathop{\text{\larger[5] C}}_{i=1}^{i=N-1}}_{j=i+1}^{j=N} t_i t_j$$

But, the problem is, symbols don't get aligned correctly (centered on the letter) like in the usual Sum expression, as you can see below -

Latex output

Can anything be done here?

akopty
  • 35
  • 1
    Look up \DeclareMathOperator* in the amsmath user guide. – barbara beeton Jul 25 '23 at 02:02
  • I can see this makes it possible to have our own mathematical operator, and the function with '*' at the end helps to have superscript and subscript under and above the particular math operator. But, as I try to make the text 'C' bigger using \text{\larger[5] C}, this creates the same output. The centering doesn't work in text mode, maybe? The \mathlarger{} doesn't take any font size type parameter like \larger[]{} do, and it doesn't increase the font that much! – akopty Jul 25 '23 at 02:35
  • Don't use $$ in LaTeX for displayed maths, instead use \[ and \] or the equation environment. $$ isn't really supported by LaTeX and can lead to improper spacing. – Skillmon Jul 25 '23 at 03:59

2 Answers2

4

Use

$$\mathop{\mathop{\vcenter{\larger[5]\hbox{C}}}_{i=1}^{i=N-1}}_{j=i+1}^{j=N} t_i t_j$$

Explanation: The \vcenter primitive centers its material vertically to math axis and the \hbox protect opening paragraph mode, i.e. the \parindent space before the big C.

Skillmon
  • 60,462
wipet
  • 74,238
4

You can combine https://tex.stackexchange.com/a/23436/4427 and https://tex.stackexchange.com/a/205520/4427

You need to judge by eye the correction factor 0.92, because different characters tend to have different behaviors.

\documentclass{article}
\usepackage{amsmath,graphicx}

\makeatletter % https://tex.stackexchange.com/a/23436/4427 \DeclareRobustCommand\bigop[2][1]{% \mathop{\vphantom{\sum}\mathpalette\bigop@{{#1}{#2}}}\slimits@ } \newcommand{\bigop@}[2]{\bigop@@#1#2} \newcommand{\bigop@@}[3]{% \vcenter{% \sbox\z@{$#1\sum$}% \hbox{\resizebox{\ifx#1\displaystyle#2\fi\dimexpr\ht\z@+\dp\z@}{!}{$\m@th#3$}}% }% }

% https://tex.stackexchange.com/a/205520/4427 \newcommand{\subalign}[2][c]{% \if#1c\vcenter\else\vtop\fi{% \Let@ \restore@math@cr \default@tag \baselineskip\fontdimen10 \scriptfont\tw@ \advance\baselineskip\fontdimen12 \scriptfont\tw@ \lineskip\thr@@\fontdimen8 \scriptfont\thr@@ \lineskiplimit\lineskip \ialign{\hfil$\m@th\scriptstyle##$&$\m@th\scriptstyle{}##$\hfil\crcr #2\crcr }% }% } \makeatother

\newcommand{\bigC}{\DOTSB\bigop[0.92]{\mathrm{C}}}

\begin{document}

[ \bigC_{\subalign{i&=1 \ j&=i+1}}^{\subalign{j&=N \ i&=N-1}} t_it_j \quad \sum_{\subalign{i&=1 \ j&=i+1}}^{\subalign{j&=N \ i&=N-1}} t_it_j ]

\end{document}

enter image description here

A comparison between the present solution (top) and the one in https://tex.stackexchange.com/a/691911/4427 but with \larger[4] (bottom).

enter image description here

egreg
  • 1,121,712