31

Normally, most people use the symbol $\Box$ to represent the d'Alembert (wave) operator (including the linked to Wikipedia page).

Recently I wanted to use \hat\Box and \tilde\Box, but they do not render very well.

boxes

What is the "best" way to create such symbols?


Aside: The above image is rendered using my local install of pdflatex: pdfTeX 3.1415926-1.40.10-2.2 (TeX Live 2009/Debian). The symbols seem to render fine on some online services: e.g. "Online LaTeX Equation Editor" produces

more boxes

from

\begin{align*}
\Box &= \sum_a \partial^a\partial_a \,, &
\hat\Box &= \sum_a \mathcal{D}^a\mathcal{D}_a
\end{align*}
3
  • 2
    +1 I would like to see a symbol that looks well when use with \nabla and \Delta. These symbols have heavier line width than \box which makes the latter look odd..
    – romeovs
    Jun 12, 2011 at 6:27
  • @romeovs: I don't use \nabla or \Delta much, but I see your point. Maybe it's worth its own question?
    – Simon
    Jun 13, 2011 at 9:58
  • Related Question: Typeset d'Alembertian operator. Feb 12, 2016 at 7:48

2 Answers 2

17

The character bounding box of \Box is wrong, the height is too low, when latexsym is used as package to get the symbol:

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

\begin{document}
\setlength{\fboxsep}{0pt}
\setlength{\fboxrule}{.1pt}
\[ \fbox{$\Box$} \fbox{$\hat\Box$} \fbox{$\tilde\Box$} \]
\begin{align*}
\Box &= \sum_a \partial^a\partial_a \,, &
\hat\Box &= \sum_a \mathcal{D}^a\mathcal{D}_a
\end{align*}
\end{document}

Result latexsym

Using amssymb instead fixes the issue:

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

\begin{document}
\setlength{\fboxsep}{0pt}
\setlength{\fboxrule}{.1pt}
\[ \fbox{$\Box$} \fbox{$\hat\Box$} \fbox{$\tilde\Box$} \]
\begin{align*}
\Box &= \sum_a \partial^a\partial_a \,, &
\hat\Box &= \sum_a \mathcal{D}^a\mathcal{D}_a
\end{align*}
\end{document}

Result amssymb

11

I try with lmodern and then fourier and the result seems correct but I agree symbols \nabla \Delta have heavier line width than \box

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb,lmodern} %and then fourier

\begin{document}

$  \hat\Box \nabla  \Delta$  

\begin{align*}
\Box &= \sum_a \partial^a\partial_a \,, &
\hat\Box &= \sum_a \mathcal{D}^a\mathcal{D}_a
\end{align*}  
\end{document}  

Finally I prefer :

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,fourier} 
\begin{document}

$  \hat\square \nabla  \Delta$  

\begin{align*}
\square &= \sum_a \partial^a\partial_a \,, &
\hat\square &= \sum_a \mathcal{D}^a\mathcal{D}_a
\end{align*}
\end{document}

with lmodern with fourier and square

3
  • 1
    Thanks Altermundus. I think that the best/easiest solution might be to use \square, that way the result is not too font dependent. I'll leave the question open for a little while to see if anyone else has suggestions.
    – Simon
    Jun 13, 2011 at 9:57
  • @Simon You use what font for the mathematics ? Jun 13, 2011 at 10:11
  • amsfonts? I'm writing a memoir class document and have the following packages loaded: \usepackage{amsmath,amsfonts,amssymb,amsthm,nccmath,latexsym,mathtools} \usepackage[mathscr]{euscript}
    – Simon
    Jun 13, 2011 at 10:19

You must log in to answer this question.

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