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.

How can I create the following symbol?

enter image description here

PS: It is not the classic \sum_{i=0}^n k

share|improve this question
2  
Will the "k" be a constant symbol, or can it vary? –  Gonzalo Medina Mar 9 at 0:20
    
@Gonzalo Medina, "k" can vary..! –  mle Mar 9 at 0:23
    
@ГарнакОлэговытц It is not ideal. With \usepackage{mathtools} , you can do \mathrlap{\sum_{i=0}^n} \;\;\; \text{\scriptsize k}. –  Aung Mar 9 at 0:31
2  
just curious, what are you using this symbol to mean? –  Oxinabox Mar 9 at 3:51

3 Answers 3

up vote 12 down vote accepted

At \scriptscriptstyle the output is not satisfying, but I don't think you need it.

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\def\mov@rlay#1#2{\leavevmode\vtop{%
   \baselineskip\z@skip \lineskiplimit-\maxdimen
   \ialign{\hfil$\m@th#1##$\hfil\cr#2\crcr}}}
\newcommand{\charfusion}[3][\mathord]{
    #1{\ifx#1\mathop\vphantom{#2}\fi
        \mathpalette\mov@rlay{#2\cr#3}
      }
    \ifx#1\mathop\expandafter\displaylimits\fi}

\newcommand{\sumk}{\charfusion[\mathop]{\sum}{\innerk}}

\newcommand{\innerk}{%
  \mathchoice
    {\mbox{\fontsize\f@size{0}\normalfont\ k}}
    {\mbox{\fontsize\sf@size{0}\normalfont\ k}}
    {\mbox{\fontsize\ssf@size{0}\normalfont\ k}}
    {\mbox{\tiny\normalfont\ k}}%
}
\makeatother

\begin{document}
\[
\sumk\textstyle\sumk\scriptstyle\sumk\scriptscriptstyle\sumk
\]

\[
\sumk_{i=1}^{n} a_{i}
\]
\end{document}

(see my answer to Mathematical symbol for disjoint set union)

enter image description here


A different implementation, where the inner symbol is given as argument.

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\sumk}[1]{\mathop{\vphantom{\sum}\mathpalette\sum@k{#1}}}
\newcommand{\sum@k}[2]{%
  \ooalign{%
    \sum@k@vc{#1}{\sum}\cr
    \hidewidth\sum@k@vc{\sum@k@next{#1}}{\mkern8mu#2}\hidewidth\cr}%
}
\newcommand{\sum@k@vc}[2]{%
  $\vcenter{\hbox{$\m@th#1#2$}}$%
}
\newcommand{\sum@k@next}[1]{%
  \ifx#1\displaystyle\displaystyle\fi
  \ifx#1\textstyle\scriptstyle\fi
  \ifx#1\scriptstyle\scriptscriptstyle\fi
  \ifx#1\scriptscriptstyle\scriptscriptstyle\fi
}
\makeatother

\begin{document}
\[
\sumk{k}_{i=1}^n\textstyle\sumk{h}\scriptstyle\sumk{r}
\]
\end{document}

enter image description here

share|improve this answer
    
Since the "k" it's a variable (see OP's comment to the question), perhaps a version with an (optional) argument would be better? –  Gonzalo Medina Mar 9 at 0:42
    
@GonzaloMedina It's quite easy. One should also know what style is needed: is it a variable or text? –  egreg Mar 9 at 9:43
    
@egreg, fantastic implementation ;), very good! :) –  mle Mar 11 at 23:02
% arara: pdflatex

\documentclass{article}
%\newcommand{\inSum}[1]{\mkern-15mu #1} % if you use that often, you can write \sum_{i=0}^{n}\inSum{j} or alike. Works only in in display math.

\begin{document}
\begin{equation}
\sum_{i=0}^{n}\mkern-16mu \mathrm{k} = \dots
\end{equation}
\end{document}

The \mathrm{} sets the letter in upright style. You may want to take this away, as k can vary and thus is a variable (italic).

Play around with the -16mu to other values, until you like it.

enter image description here

share|improve this answer
1  
.. wow, good, great, fantastic! Thanks soo much! :) ;) –  mle Mar 9 at 0:36

This makes an operator that will do what you wish, with a parameterized style that allows any letter to be put inside the summation:

\documentclass{article}

\usepackage{amsopn}
\newcommand{\suminside}[1]{\operatorname*{\sum \mkern-14mu \makebox[0.77em][l]{\footnotesize #1}}}

\begin{document}

\begin{equation}
\suminside{k}_{i=0}^n a_i = 1
\end{equation}

\begin{equation}
\suminside{d}_{i=0}^n a_i = 2
\end{equation}

\centering
Inline displays as \( \suminside{k}_{i=0}^n a_i = 2 \).

\end{document}

appears as:

Displayed and Inline Equations

share|improve this answer
    
An adjustment will be needed when it's used in in-line maths. –  Gonzalo Medina Mar 9 at 0:46
    
The spacing is not perfect when in-line; limits do behave as they should. This seems to be because of the way the sigma displays differently at the smaller size. –  cslstr Mar 9 at 1:20

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.