25

I've searched the Internet, but got nothing. In LaTeX, we can use \square for square, but how can we get a cube, I want to use it in an equation. Here is the picture:

example of equation with cube

34

The manfnt package offers \mancube and \manimpossiblecube:

\documentclass{article}
\usepackage{manfnt}

\begin{document}

\mancube

\manimpossiblecube

\end{document}

enter image description here

Those commands won't directly work in math mode, but you can use a \mbox; something like this:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{euler}
\usepackage{manfnt}

\begin{document}

\[
  \mbox{\mancube}_{n} +(n+1)^{3}
\]

\end{document}

enter image description here

Of course, you could define a command if you are going to use the cube several times:

\newcommand*\cube{\mbox{\mancube}}
  • @TorbjørnT. you're right. Boxing the cube (as in \mbox{\mancube}) you can use it in math mode. – Gonzalo Medina Jan 9 '12 at 15:40
  • Perhaps you could add that to your answer as well. – Torbjørn T. Jan 9 '12 at 15:43
  • @TorbjørnT. right again ;-) Done! – Gonzalo Medina Jan 9 '12 at 15:46
  • @GonzaloMedina: You may want to add something like \newcommand{\cube}{\mathord{\mbox{\mancube}}} to your example. – Tobi Jan 9 '12 at 15:58
  • 4
    @Tobi A safer way might be using \text of amsmath; \mathord is not needed anyway: a box in math mode is always an ordinary symbol. – egreg Jan 9 '12 at 16:03

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.