1

In https://tex.stackexchange.com/a/552557/13492, a method is shown to create both a \bigtimes symbol (for Cartesian products of families) and a \bigplus symbol (for Cartesian sums of families).

Questions:

  1. How can that be modified so that the \bigtimes does not have a square shape, that is, so that the two strokes do not cross at right angles, thereby making the symbol narrower than its height.

  2. The answer https://tex.stackexchange.com/a/552769/13492 includes a \scalebox with a horizontal \scalefactor whose value is essentially hard-coded according to which symbol is being targeted. Can the code with \scalefactor be modified to incorporate an additional argument, defaulting to 1, for that horizontal scale factor?

  3. Given the intended usage, where both symbols take sub- and/or super-scripts for indexing, does one not need either \DeclareMathOperator or \mathop? If so, how should that be incorporated; if not, why not?

Source: The code from https://tex.stackexchange.com/a/552557/13492 is supplemented by two different — commented-out — methods I tried to use to accomplish the goal of 1.

\documentclass[fleqn]{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{\my@big}[1]{% \mathop{\vphantom{\sum}\mathpalette\my@makebig{#1}}\slimits@ } \AtBeginDocument{% \DeclareRobustCommand{\bigplus}{\DOTSB\my@big\my@plus}% \DeclareRobustCommand{\bigtimes}{\DOTSB\my@big\my@times}% } \newcommand{\my@makebig}[2]{% \vcenter{% \sbox\z@{$\m@th#1\sum$}% \setlength{\unitlength}{0.9\dimexpr\ht\z@+\dp\z@}% \hbox{\kern0.1\wd\z@\my@draw{#1}{#2}\kern0.1\wd\z@}% }% } \newcommand{\my@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{\my@plus}{% \roundcap \Line(0.5,0)(0.5,1) \Line(0,0.5)(1,0.5) } \newcommand{\my@times}{% \roundcap \Line(0,0)(1,1) \Line(0,1)(1,0) }

%% Attempt #1 to try to reshape \bigtimes... %% ...leaves too much space after \bigtimes... %% ... and displaystyle puts sub- & super-scripts off-center %\newcommand{\my@times}{% % \roundcap % \Line(0,0)(0.75,1) % \Line(0,1)(0.75,0) %}

%% Attempt #2 to reshape \bigtimes, using \scalebox instead ... %% ... makes lines too thin and leaves too much space after \bigtmies... %% ... and displaystyle puts sub- & super-scripts off-center: %\newcommand{\my@@times}{% % \roundcap % \Line(0,0)(1,1) % \Line(0,1)(1,0) %} %\usepackage{graphicx} %\newcommand{\my@times}{% % \scalebox{0.85}[1]{\my@@times}% %}

\makeatother

\begin{document}

In-line $ \bigplus_{i\in I} X_i = \bigtimes_{j\in J} Y_i = \bigcup_{i\in I} Z_{i} = \bigcap_{n\in I} Z_{i} $ here. [ \bigplus_{i\in I} X_i = \bigtimes_{j\in J} Y_i = \bigcup_{i\in I} Z_i = \bigcap_{n\in I} Z_{i} ]

In-line $ \bigplus_{i=0}^{\infty} X_i = \bigtimes_{j=0}^{\infty} Y_i = \bigcup_{i=0}^{\infty} Z_{i} = \bigcap_{n=0}^{\infty} Z_{i} $ here. [ \bigplus_{i=0}^{\infty} X_i = \bigtimes_{j=0}^{\infty} Y_i = \bigcup_{i=0}^{\infty} Z_i = \bigcap_{n=0}^{\infty} Z_{i} ] \end{document}

Output: All output shown was produced using XeLaTeX; the results are similar if pdfLaTeX is used instead.

First is the output using the original code from https://tex.stackexchange.com/a/552557/13492.

Original, square-shape bigtimes

Second, the output if my Attempt 1 is used, which leaves too much space after \bigtimesin inline mode and puts sub- & super-scripts off-center in display mode:

Attempt #1 bigtimes

Third, the output if my Attempt 2 is used, which also leaves too much space after \bigtimesin inline mode and puts sub- & super-scripts off-center in display mode:

Attempt #2 bigtimes using scalebox

murray
  • 7,944
  • A completely satisfactory solution is given by https://tex.stackexchange.com/a/552914/13492. – murray Jul 09 '20 at 15:31

2 Answers2

1

By creating separate \my@narrowbig, \my@narrowmakebig, and \my@narrowdraw, and \my@narrowtimes commands, using a drawing canvas 0.75 wide and 1 high, I can get a more-or-less suitable non-square \bigtimes operator symbol for Cartesian product. And similarly a \bigbox operator symbol for box product (in the topological sense).

The results:

non-square, corrected, bigtimes and bigbox

The code is shown below.

Complaints:

  1. When viewed on-screen, the strokes of the new symbols seem OK; but when printed, the strokes of \bigtimes, \bigsum, and \bigbox seem a bit too thick as compared to that of \bigcup an \bigcap. How should that be fixed?
  2. It seems like a terrible waste of code to have to create two sets of commands — one for \bigsum and another for the other new operator symbols. Is there some way to combine the codes?

The modified source:

\documentclass[fleqn]{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{\my@big}[1]{% \mathop{\vphantom{\sum}\mathpalette\my@makebig{#1}}\slimits@ } \newcommand{\my@narrowbig}[1]{% \mathop{\vphantom{\sum}\mathpalette\my@narrowmakebig{#1}}\slimits@ } \AtBeginDocument{% \DeclareRobustCommand{\bigplus}{\DOTSB\my@big\my@plus}% %\DeclareRobustCommand{\bigtimes}{\DOTSB\my@big\my@times}% \DeclareRobustCommand{\bigtimes}{\DOTSB\my@narrowbig\my@narrowtimes}% \DeclareRobustCommand{\bigbox}{\DOTSB\my@narrowbig\my@narrowbox}% } \newcommand{\my@makebig}[2]{% \vcenter{% \sbox\z@{$\m@th#1\sum$}% \setlength{\unitlength}{0.9\dimexpr\ht\z@+\dp\z@}% \hbox{\kern0.1\wd\z@\my@draw{#1}{#2}\kern0.1\wd\z@}% }% } \newcommand{\my@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{\my@plus}{% \roundcap \Line(0.5,0)(0.5,1) \Line(0,0.5)(1,0.5) } \newcommand{\my@times}{% \roundcap \Line(0,0)(1,1) \Line(0,1)(1,0) } \newcommand{\my@narrowtimes}{% \roundcap \Line(0,0)(0.75,1) \Line(0,1)(0.75,0) } \newcommand{\my@narrowbox}{% %\roundcap \Line(0,0)(0.75,0) \Line(0.75,0)(0.75,1) \Line(0.75,1)(0,1) \Line(0,1)(0,0) } \newcommand{\my@narrowmakebig}[2]{% \vcenter{% \sbox\z@{$\m@th#1\sum$}% \setlength{\unitlength}{0.9\dimexpr\ht\z@+\dp\z@}% \hbox{\kern0.1\wd\z@\my@narrowdraw{#1}{#2}\kern0.1\wd\z@}% }% } \newcommand{\my@narrowdraw}[2]{% \begin{picture}(0.75,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}% }

%% Attempt #1 to try to reshape \bigtimes... %% ...leaves too much space after \bigtimes %\newcommand{\my@times}{% % \roundcap % \Line(0,0)(0.75,1) % \Line(0,1)(0.75,0) %}

%% Attempt #2 to reshape \bigtimes, using \scalebox instead ... %% ... makes lines too thin and leaves too much space after \bigtmies %\newcommand{\my@@times}{% % \roundcap % \Line(0,0)(1,1) % \Line(0,1)(1,0) %} %\usepackage{graphicx} %\newcommand{\my@times}{% % \scalebox{0.85}[1]{\my@@times}% %}

\makeatother

\begin{document}

In-line $ \bigplus_{i\in I} X_i = \bigtimes_{i\in J} Y_i = \bigbox_{i\in I} X_{i} = \bigcup_{i\in I} Z_{i} = \bigcap_{n\in I} Z_{i} $ here. [ \bigplus_{i\in I} X_i = \bigtimes_{i\in J} Y_i = \bigbox_{i\in I} X_{i}= \bigcup_{i\in I} Z_i = \bigcap_{n\in I} Z_{i} ]

In-line $ \bigplus_{i=0}^{\infty} X_i = \bigtimes_{i=0}^{\infty} Y_i = \bigbox_{i=0}^{\infty} X_{i} = \bigcup_{i=0}^{\infty} Z_{i} = \bigcap_{n=0}^{\infty} Z_{i} $ here. [ \bigplus_{i=0}^{\infty} X_i = \bigtimes_{i=0}^{\infty} Y_i = \bigbox_{i=0}^{\infty} X_{i} = \bigcup_{i=0}^{\infty} Z_i = \bigcap_{n=0}^{\infty} Z_{i} ]

\end{document}

murray
  • 7,944
1

The problem here is only that in \my@draw, you use a picture environment which has a fixed width of \unitlength, regardless of the content of the picture environment. Hence, the picture environment for the \bigtimes symbol, which I guess you expected to have a width of 0.85\unitlength because of the \scalebox in \my@times, still has a width of \unitlength.

There are probably many ways to fix that, but I think the easiest way would be to place the call of \my@draw in \my@makebig in the \scalebox, instead of placing the content of \my@times in the \scalebox. This is what I did in the following example.

\documentclass[fleqn]{article}
\usepackage{amsmath,pict2e}
\usepackage{graphicx}

\usepackage{newtxtext,newtxmath}

\newif\iftimes \timesfalse \makeatletter \newcommand{\my@big}[1]{% \mathop{\vphantom{\sum}\mathpalette\my@makebig{#1}}\slimits@% } \AtBeginDocument{% \DeclareRobustCommand{\bigplus}{\timesfalse\DOTSB\my@big\my@plus}% \DeclareRobustCommand{\bigtimes}{\timestrue\DOTSB\my@big\my@times}% } \newcommand{\my@makebig}[2]{% \iftimes \def\scalefactor{0.85}% \else \def\scalefactor{1}% \fi% \vcenter{% \sbox\z@{$\m@th#1\sum$}% \setlength{\unitlength}{0.9\dimexpr\ht\z@+\dp\z@}% \hbox{\kern0.1\wd\z@\scalebox{\scalefactor}[1]{\my@draw{#1}{#2}}\kern0.1\wd\z@}% }% } \newcommand{\my@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{\my@plus}{% \roundcap \Line(0.5,0)(0.5,1) \Line(0,0.5)(1,0.5) } \newcommand{\my@times}{% \roundcap \Line(0,0)(1,1) \Line(0,1)(1,0) } \makeatother

\begin{document} In-line $ \bigplus_{i\in I} X_i = \bigtimes_{j\in J} Y_i = \bigcup_{i\in I} Z_{i} = \bigcap_{n\in I} Z_{i} $ here. [ \bigplus_{i\in I} X_i = \bigtimes_{j\in J} Y_i = \bigcup_{i\in I} Z_i = \bigcap_{n\in I} Z_{i} ]

In-line $ \bigplus_{i=0}^{\infty} X_i = \bigtimes_{j=0}^{\infty} Y_i = \bigcup_{i=0}^{\infty} Z_{i} = \bigcap_{n=0}^{\infty} Z_{i} $ here. [ \bigplus_{i=0}^{\infty} X_i = \bigtimes_{j=0}^{\infty} Y_i = \bigcup_{i=0}^{\infty} Z_i = \bigcap_{n=0}^{\infty} Z_{i} ] \end{document}

I thought it was better to keep the same \my@makebig command for both \bigtimes and \bigplus, but I didn't want to mess with the call of \mathpalette in \my@big by adding another argument to \my@makebig. This is why I added the \iftimes statement, but I'm really no expert, and I guess there might be a better way to do that.

Anyway, here's the output of the example, which I compiled with pdfLaTeX.

Vincent
  • 20,157
  • I don't like that this hard-codes the scale factor. I very much want to be able to supply the scale factor as an additional argument, but taking a default value of 1. – murray Jul 08 '20 at 19:33
  • A completely satisfactory solution is given by https://tex.stackexchange.com/a/552914/13492. – murray Jul 09 '20 at 15:31