2

I have the following line of code :

$$
\operatorname{aff}(\mathcal{C})
\coloneqq
\{
\lambda_{1}x_{1}+\lambda_{2}x_{2}+\cdots+\lambda_{k}x_{k}
\mid 
x_{1},x_{2},\ldots,x_{k}\in\mathcal{C},\sum_{i}\lambda_{i}=1
\}
$$

which should generate the following expression :

enter image description here

I wish to know if there is a way to replace the summation notation above and replace it with the smaller summation notation used in text mode i.e. the one below :

$\sum_{i}\lambda_{i}$ 

enter image description here

I attempted to use \text{$\sum_{i}$} in math mode but it did not work because it gave me the large summation notation.

1

3 Answers 3

5

Use \textstyle.

And use \[\] instead of $$ $$ for display style math.

Improved Answer (modification according to Zarko's and egreg's comments):

\documentclass{article}

\usepackage{mathtools}

\begin{document}
\[
\operatorname{aff}(\mathcal{C})
\coloneqq
\{
\lambda_{1}x_{1}+\lambda_{2}x_{2}+\cdots+\lambda_{k}x_{k}
\mid
x_{1},x_{2},\ldots,x_{k}\in\mathcal{C},{\textstyle\sum_{i}\lambda_{i}}=1
\}
\]

\end{document}

enter image description here

  • Removed the amsmath package as it is loaded by the mathtools package (mentioned by zarko).
  • Grouped the part that is to be displayed by \textstyle in the text style mode as \textstyle is not a macro (mentioned by egreg).

Original Problametic answer:

\documentclass{article}

\usepackage{amsmath}
\usepackage{mathtools}


\begin{document}
\[
\operatorname{aff}(\mathcal{C})
\coloneqq
\{
\lambda_{1}x_{1}+\lambda_{2}x_{2}+\cdots+\lambda_{k}x_{k}
\mid
x_{1},x_{2},\ldots,x_{k}\in\mathcal{C},\textstyle{\sum_{i}\lambda_{i}}=1
\}
\]
\end{document}

enter image description here

4
  • 1
    mathtools call amsmath, so you not need to load it again. Also definition for new operator name is better to have in preamble.
    – Zarko
    Dec 26, 2021 at 16:14
  • 1
    Note that \textstyle doesn't take an argument: it's a declaration whose effect ends with the formula.
    – egreg
    Dec 26, 2021 at 16:19
  • Thank you @Zarko for your suggestion. I have tried to edit accordingly.
    – Imran
    Dec 26, 2021 at 16:39
  • Thank you @egreg for your suggestion. I have tried to edit accordingly. (Can't mention 2 in a single comment!)
    – Imran
    Dec 26, 2021 at 16:39
7

For a one-off case you can use Zarko's method.

If you need it several times, you can define a command that forces text style when the symbol is to be used in display style. However, I'd also use \big size for the braces.

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

\DeclareMathOperator{\aff}{aff}

\makeatletter
\newcommand{\tsum}{\DOTSB\mathop{\tsum@}\nolimits}
\newcommand{\tsum@}{\mathchoice{\textstyle\sum}{\sum}{\sum}{\sum}}
\makeatother

\begin{document}

\[
\aff{\mathcal{C}}\coloneqq
\bigr\{
  \lambda_{1}x_{1}+\lambda_{2}x_{2}+\cdots+\lambda_{k}x_{k}
  \mid
  x_{1},x_{2},\ldots,x_{k}\in\mathcal{C},\tsum_{i}\lambda_{i}=1
\bigr\}
\]

\end{document}

enter image description here

4

A wee bit modified @Imran answer:

\documentclass{article}
\usepackage{mathtools}
\DeclareMathOperator{\aff}{aff} % <---

\begin{document}
\[
\aff(\mathcal{C})\coloneqq
\bigl\{  % <---
\lambda_{1}x_{1}+\lambda_{2}x_{2}+\cdots+\lambda_{k}x_{k}
\mid
x_{1},x_{2},\ldots,x_{k}\in\mathcal{C},{\textstyle\sum_{i}}\lambda_{i}=1 % <---
\bigr\}   % <---
\]
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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