4

My question is very short and it is not a duplicate because I want the symbol \square with a better position using mtpro2 package which it is not perfect. Infact if I use the symbol \square for the Dalambertian operator with this MWE,

\documentclass{article}
\usepackage{mathtools,amssymb}
\usepackage{newtxtext}
\usepackage{newtxmath}

\begin{document}
\[
L'=L+\mu_{0}\square\cdot (fX)
\]
\end{document}

enter image description here

the square symbol (\square) is small because I'm using \usepackage{newtxmath}, but is a bit far from the \cdot symbol but is in line with all the characters. Obviously I could insert a negative space before \cdot but I would like to avoid doing so. But using the package \usepackage[lite]{mtpro2}, the symbol \square change but it's bigger than the previous symbol and different.

How is it possible to have a square symbol (better centered) that aesthetically fits better as a Dalambertian operator and is closer to the dot of \cdot?

\documentclass{article}
\usepackage{mathtools,amssymb}
\usepackage{newtxtext}
\usepackage[lite]{mtpro2}
\begin{document}
\[
L'=L+\mu_{0}\square\cdot (fX)
\]
\end{document}

enter image description here

  • why use a font whose behaviour you don't like? – ufo Apr 16 at 12:14
  • @ufo I like very much mtpro2 font. My questions are founded, often, on this font. – Sebastiano Apr 16 at 12:16
  • 2
    Possible duplicate of Importing a Single Symbol From a Different Font – ufo Apr 16 at 12:19
  • 2
    Maybe employ a macro that does this: \vcenter{\hbox{$\square$}}\!\cdot. Sorry, I can't help as i don't have mtpro2 font. Alternately, you could save the old \square before loading mtpro2 and use that instead. – Steven B. Segletes Apr 16 at 12:36
  • 2
    The distance is caused by the binary operator \cdot and not by \square. Except for \! there is not much you can do about it. – Skillmon Apr 16 at 12:56
3

Maybe just writing {\cdot} rather than \cdot gives you the desired spacing. I don't have mtpro2, so this is with your original code:

Sample output

\documentclass{article}
\usepackage{mathtools,amssymb}
\usepackage{newtxtext}
\usepackage{newtxmath}

\begin{document}
\[
L'=L+\mu_{0}\square{\cdot} (fX)
\]
\end{document}
  • 1
    Maybe \mathop{\square\cdot}? This makes a reasonable spacing with the symbol before. – campa Apr 17 at 7:40
3

You can import a symbol from another font. But the space after the square is not triggered by the square but by the binary symbol. If you would change the definition of \square to suppress this space it would give bad results if ordinary symbols are after the square:

\documentclass{article}
\usepackage{mathtools,amssymb}
\usepackage{newtxtext}
\usepackage[lite]{mtpro2}
\DeclareSymbolFont{AMSm}{U}{ntxsym}{m}{n}
\DeclareMathSymbol{\ntxsquare} {\mathord}{AMSm}{131}

\begin{document}
\[
L'=L+\mu_{0}\ntxsquare\cdot (fX)
\]


\[
L'=L+\mu_{0}\ntxsquare\mathpunct{\cdot} (fX)
\]


\[
L'=L+\mu_{0}\ntxsquare\!\cdot (fX)
\]

\[
L'=L+\mu_{0}\ntxsquare\! x (fX) %bad
\]

\end{document}

enter image description here

  • Very nice answer. Excuse me very much but I have taken the shorter answer with the check green. Always thank you. – Sebastiano Apr 17 at 10:57
3

You can create your own square symbol with a definable size very easily by using \fbox, you can adjust it to your liking by changing the \fboxrule thickness and the size of the \phantomed \rule.

With this definition the size of the symbol doesn't change in sub or super script.

\documentclass[]{article}

\newlength\mysquaresize
\newcommand\mysquare
  {%
    \begingroup
    \fboxrule=.12ex
    \mysquaresize=1ex
    \fboxsep=-\fboxrule
    \vcenter{\hbox{\fbox{\phantom{\rule{\mysquaresize}{\mysquaresize}}}}}%
    \endgroup
  }

\begin{document}
\[
L'=L+\mu_{0}\mysquare\cdot (fX)
\]
\end{document}

enter image description here

A version in which you can also define sizes in the different math modes:

\documentclass[border=3.14,11pt]{standalone}

\newlength\mysquaresize
\newcommand\mysquare
  {%
    \mathchoice
      {\mysquareaux{.12ex}{1ex}}
      {\mysquareaux{.12ex}{1ex}}
      {\mysquareaux{.11ex}{.8ex}}
      {\mysquareaux{.10ex}{.7ex}}%
  }
  \newcommand\mysquareaux[2]
  {%
    \begingroup
    \fboxrule=#1
    \mysquaresize=#2
    \fboxsep=-\fboxrule
    \vcenter{\hbox{\fbox{\phantom{\rule{\mysquaresize}{\mysquaresize}}}}}%
    \endgroup
  }

\begin{document}
$
\displaystyle
L'=L+\mu_{0}\mysquare\cdot (fX)
$
\end{document}
  • Always thank you also to you. – Sebastiano Apr 17 at 10:58

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.