2

I want to create from suitable symbols ‐ and not using TikZ or other drawing method — large sum (\bigsum) and large times (\mybigtimes) math symbols, for cartesian sum and cartesian product, respectively, that:

  • are the same vertical size as \bigcup and \bigcap;
  • have strokes with the same thickness as the curves in \bigcup and \bigcap;
  • in the case of \mybigtimes, is scaled down horizontally only;
  • will scale properly for in-line math, display math, etc. (presumably, by using \mathchoice; and
  • will work with both pdfLaTeX and `XeLaTeX.

How can this be done?

Here is what I have so far. The output shown is produced only when the part after This does \emph{not} work is commented out.

\documentclass[12pt,fleqn]{article}
\usepackage{amsmath}
\usepackage{iftex}

\ifTUTeX
  \usepackage{fontspec}
  \usepackage{unicode-math}
  \defaultfontfeatures{ Scale=MatchLowercase, Ligatures=TeX }
  \setmainfont{TeX Gyre Termes}[Scale=1.0]
  \setmathfont{TeX Gyre Termes Math}
  \mathchardef\timessymbol=\numexpr\times-"2000\relax % WHAT IS THE NAME-NUMBER?
\else
  \RequirePackage[scaled=0.93]{newtxtext}
  \RequirePackage{newtxmath}%
  \mathchardef\timessymbol=\numexpr\times-"2000\relax % WHAT IS THE NAME-NUMBER?
\fi

\usepackage{graphicx}
\usepackage{scalerel}
\DeclareMathOperator*{\bigplus}{\scalerel*{+}{\sum}}
\DeclareMathOperator*{\Bigplus}{\scalerel*{+}{\textstyle\sum}}

% Attempt to shrink a big times horizontally:
\DeclareMathOperator*{\mybigtimes}{\scalebox{0.7}[1]{\timessymbol}}

\begin{document}
\ifTUTeX With Xe\LaTeX\else With pdf\LaTeX\fi

\bigskip
These work, but geometry is wrong:

\bigskip

$\bigtimes_{n=0}^{\infty} X_{i} = \bigcup_{k=0}^{\infty}U_{k}$ 
\quad to shrink \verb!\bigtimes! horizontally (but not vertically)

\bigskip
$\bigplus_{n=0}^{\infty} X_{i} = \bigcap_{k=0}^{\infty}U_{k}$ \quad \verb!\bigsum! too thick 
%
\begin{gather*}
\bigtimes_{n=0}^{\infty} X_{i}= \bigcup_{k=0}^{\infty}U_{k}
\quad \text{to shrink bigtimes symbol horizontally (but not vertically)}
\\
\bigplus_{n=0}^{\infty} X_{i} = \bigcap_{k=0}^{\infty}U_{k} 
\quad \text{bigplus symbol too thick}
\end{gather*}

This does \emph{not} work:

$\mybigtimes_{n=0}^{\infty} X_{i}$
\[
\mybigtimes_{n=0}^{\infty} X_{i}
\]
\end{document} 

XeLaTeX output

pdfLaTeX output

Related:

https://tex.stackexchange.com/a/394912/13492

Big cartesian product & cartesian sum symbols with Lucida Math fonts?

Continuation: See Make non-square bigtimes.

2
  • The requirement that the strokes have the same thickness means that you probably won’t be able to get what you want by scaling an existing symbol. You could instead draw a pair of intersecting lines, using TikZ, on a canvas set to the height and depth of \cup, and select the thickness based on \mathchoice.
    – Davislor
    Jul 7, 2020 at 4:14
  • A completely satisfactory solution is given by tex.stackexchange.com/a/552914/13492.
    – murray
    Jul 9, 2020 at 15:32

2 Answers 2

5

You can use \pdfliteral directly in pdfTeX:

\def\mybigtimes{\mathop{\mathchoice{%display:
   \vcenter{\hbox to10bp{\vrule height15bp width0pt \pdfliteral{
   q 1 J .8 w 0 1 m 10 14 l S 0 14 m 10 1 l S Q
}\hss}}}{%text:
   \vcenter{\hbox to10bp{\kern1bp\vrule height10bp width0pt \pdfliteral{
   q 1 J .65 w 0 0 m 8 10 l S 0 10 m 8 0 l S Q
}\hss}}}{\times}{\times}%script, scriptscript not defined
}}

\def\mybigplus{\mathop{\mathchoice{%display:
   \vcenter{\hbox to12bp{\vrule height15bp width0pt \pdfliteral{
   q 1 J .8 w 0 7.5 m 12 7.5 l S 6 1 m 6 14 l S Q
}\hss}}}{%text:
   \vcenter{\hbox to12bp{\kern1bp\vrule height10bp width0pt \pdfliteral{
   q 1 J .65 w 0 5 m 10 5 l S 5 0 m 5 10 l S Q
}\hss}}}{+}{+}%script, scriptscript not defined
}}

You can define \def\pdfliteral#1{\special{pdf:literal #1}} in XeTeX and then you can use the same macros.

myplus

5
  • I want the symbols to be glyphs with unicode codes, so that the pdf output will pass PDF A/2-u validation. Isn't this method essentially just drawing, hence not producing such a unicode-known glyph?
    – murray
    Jul 7, 2020 at 15:17
  • If I am going to get what is essentially a drawing with this method, is there any particular advantage to it over using, say, TikZ?
    – murray
    Jul 7, 2020 at 15:22
  • @murray I cannot find Unicode slot for bigsum and bigtimes. So, these symbols cannot be realized as given Unicode-known glyphs.
    – wipet
    Jul 7, 2020 at 15:43
  • \pdfliteral is better (in such simple tasks) than TikZ because it is much more simpler, compact and you need not to load any external package (tikz has more than 30k lines of code).
    – wipet
    Jul 7, 2020 at 15:45
  • I will also need a script style of these. And I will need a rectangular box command \bigbox producing a rectangular box operator having the same dimensions as the \bigtimes; how would one do that?
    – murray
    Jul 8, 2020 at 15:08
4

This is the image with pdflatex:

enter image description here

This is the image with xelatex:

enter image description here For mysterious reasons, the developers of TeX Gyre Termes Math decided not to give all big operators the same dimensions. It's up to you to decide whether to use \bigcup as a model or \sum as in the code below.

\documentclass{article}
\usepackage{amsmath,pict2e}
\usepackage{iftex}

\ifTUTeX
  \usepackage{unicode-math}
  \setmainfont{TeX Gyre Termes}[Scale=1.0]
  \setmathfont{TeX Gyre Termes Math}
\else
  \usepackage{newtxtext,newtxmath}
\fi

\makeatletter
\newcommand{\murray@big}[1]{%
  \mathop{\vphantom{\sum}\mathpalette\murray@makebig{#1}}\slimits@
}
\AtBeginDocument{%
  \DeclareRobustCommand{\bigplus}{\DOTSB\murray@big\murray@plus}%
  \DeclareRobustCommand{\bigtimes}{\DOTSB\murray@big\murray@times}%
}

\newcommand{\murray@makebig}[2]{%
  \vcenter{%
    \sbox\z@{$\m@th#1\sum$}%
    \setlength{\unitlength}{0.9\dimexpr\ht\z@+\dp\z@}%
    \hbox{\kern0.1\wd\z@\murray@draw{#1}{#2}\kern0.1\wd\z@}%
  }%
}

\newcommand{\murray@draw}[2]{%
  \begin{picture}(1,1)
    \linethickness{%
      \ifx#1\displaystyle 1.2\fontdimen8\textfont3\else
      \ifx#1\textstyle 1.1\fontdimen8\textfont3\else
      \ifx#1\scriptstyle1\fontdimen8\scriptfont3\else
      1\fontdimen8\scriptscriptfont3\fi\fi\fi
    }%
    #2
  \end{picture}%
}


\newcommand{\murray@plus}{%
  \roundcap
  \Line(0.5,0)(0.5,1)
  \Line(0,0.5)(1,0.5)
}
\newcommand{\murray@times}{%
  \roundcap
  \Line(0.14645,0.14645)(0.85355,0.85355)
  \Line(0.14646,0.85355)(0.85355,0.14645)
}
\makeatother

\begin{document}

$\displaystyle\bigplus_{k=0}^\infty \bigcup_{k=0}^\infty \bigtimes_{k=0}^\infty$

\medskip

$\textstyle\bigplus_{k=0}^\infty \bigcup_{k=0}^\infty \bigtimes_{k=0}^\infty$

\medskip

$\scriptstyle\bigplus_{k=0}^\infty \bigcup_{k=0}^\infty \bigtimes_{k=0}^\infty$

\medskip

$\scriptscriptstyle\bigplus_{k=0}^\infty \bigcup_{k=0}^\infty \bigtimes_{k=0}^\infty$

\end{document}
6
  • I'm trying to avoid drawing the symbols, whether with TikZ or the picture environment, etc. The purpose is to get a glyph that will be unicode, so that the pdf output will pass PDF A/2-u validation.
    – murray
    Jul 7, 2020 at 15:14
  • The \bigtimes here does not shrink horizontally what is essentially a rotated cross, so that the symbol width is smaller than its height, i.e., the two lines no longer cross at 90-degree angles.
    – murray
    Jul 7, 2020 at 15:21
  • If I am going to get what is essentially a drawing with this method, is there any particular advantage to it over using, say, TikZ?
    – murray
    Jul 7, 2020 at 15:22
  • @murray It's simpler than TikZ. If you want to shrink the times symbol, do it.
    – egreg
    Jul 7, 2020 at 15:58
  • Please see tex.stackexchange.com/questions/552679/make-non-square-bigtimes for more about this.
    – murray
    Jul 8, 2020 at 0:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .