1

I'm trying to add a square to my latex document. I'm trying to do this using the $ \square $ command. However in my latex document I get the error:

Missing } inserted

If I type $ \square{} $, there's no error, but it looks like the output of $()^2$. Does anyone know how to solve this? Here's my Preamble:

\documentclass[a4paper,12pt,numbers=noenddot]{scrreprt} 
\usepackage[applemac]{}
\usepackage[T1]{fontenc}
\usepackage{fancyhdr}
\usepackage[dvips]{graphics}
\usepackage[dvips]{graphicx}
\usepackage{color}
\usepackage{longtable}
\usepackage{supertabular}
\usepackage{lscape}
\usepackage{afterpage}
\usepackage{setspace}
\usepackage{calc}
\usepackage{verbatim}
\usepackage{latexsym}
\usepackage{float,rotating}
\usepackage[justification=raggedright,singlelinecheck=false]{caption}
\usepackage{placeins}
\usepackage[ngerman]{babel}
\usepackage{bibgerm}
\usepackage{textcomp}
\usepackage{epsfig}
\usepackage{floatfig}
\usepackage{wrapfig}
\usepackage{psfrag}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{wasysym}
\usepackage[amssymb,thinspace]{SIunits}
\usepackage{enumerate}
\usepackage[version=3]{mhchem}
\usepackage{remreset}
\usepackage{stmaryrd} 
\usepackage{dcolumn}
\usepackage{multirow}
\usepackage{footnpag}
\usepackage{booktabs} 

\usepackage[numbers,sort]{natbib}
\usepackage{listings}
\usepackage{hyph}
\usepackage{boxit}

\begin{document}
$\square$
\end{document}
10
  • 2
    Welcome to TEX.SE! Please provide a full minimal working example which reproduces the issue, possibly starting with \documentclass{...} and ending with \end{document}. In this way we can copy-paste the code and look at the problem without resorting to wild guesses about what you are doing.
    – campa
    Aug 16, 2019 at 11:42
  • 4
    From your description, I'd say that \square{X} is supposed to produce "X²", so the command is said to have an "argument", which in this case was "X". If you do only $\square$, the command never sees the argument it was expecting and then produces some error. So the correct usage is \square{<stuff-to-be-squared>}. Aug 16, 2019 at 11:46
  • 4
    The SIunits package redefines \square. See the package documentation for how to handle this. (@PhelypeOleinik) Aug 16, 2019 at 11:55
  • 5
    An unrelated piece of advice, though: You seem to be using way too many packages. Perhaps you inherited this preamble from somewhere. Recommended practice is only to use packages that you know you will need. This leads to fewer problems overall. The line \usepackage[applemac]{} makes no sense. Get rid of it. Aug 16, 2019 at 12:02
  • 4
    you should not be loading \usepackage{epsfig} in any document written after 1994, it's just a legacy wrapper for older documents. No need to specify graphics Aug 16, 2019 at 12:19

1 Answer 1

1

The following minimal example replicates the behaviour:

\documentclass{article} 

\usepackage[amssymb]{SIunits}

\begin{document}

$\square$

\end{document}

Here's what you see in the .log when you compile the above document:

Option `amssymb' provided! 
Command \square redefined by SIunits package!

From the SIunits documentation about the amssymb package option:

This option redefines the amssymb command \square to get the desired SIunits definition of the command. Note: When using this option, the amssymb command \square can not be used.

The redefinition changes \square from a symbol into

\renewcommand{\square}[1]{\power{#1}{2}}

which represents the square - x2 - of a number.


If you still want to use \square from amssymb, SIunits provides the squaren package option, that allows you to use \squaren instead of \square for siunits' squaring. That is, \square still retains its original definition of a square under amssymb.

The suggestion moving forward would be to use the more modern siunitx package which provides backwards compatibility with SIunits. siunitx is under development while development of SIunits has stalled since 2007 (in lieu of siunitx).

1
  • Sigh. This is a good example of why it would really be nice to have a comprehensive list of known conflicts. (Will never happen, I know, but ...) Mar 26, 2020 at 23:08

You must log in to answer this question.

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