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:
[Tex/LaTex] Symbol for cube
math-modesymbols
Related Solutions
The \sqrt
command takes as a mandatory argument what's to be extracted the square root of.
So the correct syntax is
\sqrt{a+b}
not \sqrt(a+b)
. Your problem is solved by using
Q^*=\sqrt{\frac{2K\lambda}{h}}
If you need the cube root (or other roots), there's the optional argument:
\sqrt[3]{a}
In a previous version of your question you had \sqrtsign
: this macro actually exists for historical reasons, but is not documented and should not be used in documents.
Here, I introduce \pigpenXXXX
where XXXX
is some combination of 0
and 1
that signify strokes on the left, top, right, bottom (i.e., clockwise starting on left). Stroke length and width are defined by \rlln
and \rlwd
, respectively. The symbols are defined to sit on the baseline.
Naturally, one could define letters like \def\ppA{\pigpen0011}
, etc.
EDITED to make suitable for use in math mode, though it will also function in text mode.
\documentclass{article}
\usepackage{stackengine}
\newlength\rlln
\newlength\rlwd
\newlength\brlwd
\newlength\trlwd
\newlength\lrlwd
\newlength\rrlwd
\rlwd=.5pt
\rlln=5pt
\def\bstr{\rule{\rlln}{\brlwd}\rule{0pt}{\rlwd}}
\def\tstr{\rule{\rlln}{\trlwd}\rule{0pt}{\rlwd}}
\def\lstr{\ooalign{\rule{\lrlwd}{\rlln}\cr\rule{\rlwd}{0pt}}}
\def\rstr{\ooalign{\rule{\rrlwd}{\rlln}\cr\rule{\rlwd}{0pt}}}
\def\gap{\rule{\dimexpr\rlln-2\rlwd}{0pt}}
\def\pigpen#1#2#3#4{\kern1pt% FOUR ARGUMENTS ARE LEFT, TOP, RIGHT, BOTTOM STROKES
\brlwd=#4\rlwd\relax%
\trlwd=#2\rlwd\relax%
\lrlwd=#1\rlwd\relax%
\rrlwd=#3\rlwd\relax%
\stackengine{\dimexpr\rlln-\rlwd}{%
\stackengine{0pt}{\bstr}{\lstr\gap\rstr}{O}{c}{F}{F}{L}%
}{\tstr}{O}{c}{F}{F}{L}\kern1pt%
}
\begin{document}
$x\pigpen0011 \pigpen1011 \pigpen1001 \pigpen0111
\pigpen1111 \pigpen1101 \pigpen0110 \pigpen1110
\pigpen1100 \pigpen1010 \pigpen0101 y$
\end{document}
UPDATE:
The OP requested a version with rounded endcaps. To do so, I use my custom style file roundrule.sty
, found exclusively at the end of this answer:
Is there such a thing as a `\mathrule`? (rounded endcaps)
I then modify my above answer to use round rules instead of rules. I probably need to update roundrule.sty
, because I found that if one of the rule dimensions is 0pt, it still outputs a thin line. To circumvent that problem for this answer, I perform a check on the roundrule dimensions.
\documentclass{article}
\usepackage{stackengine,roundrule}
\newlength\rlln
\newlength\rlwd
\newlength\brlwd
\newlength\trlwd
\newlength\lrlwd
\newlength\rrlwd
\newcommand\rrule[2]{\ifdim#1>0pt\relax\ifdim#2>0pt\relax\roundrule{#1}{#2}\else\fi\else\fi}
\rlwd=.5pt
\rlln=5pt
\def\bstr{\rrule{\rlln}{\brlwd}\rule{0pt}{\rlwd}}
\def\tstr{\rrule{\rlln}{\trlwd}\rule{0pt}{\rlwd}}
\def\lstr{\ooalign{\rrule{\lrlwd}{\rlln}\cr\rule{\rlwd}{0pt}}}
\def\rstr{\ooalign{\rrule{\rrlwd}{\rlln}\cr\rule{\rlwd}{0pt}}}
\def\gap{\rule{\dimexpr\rlln-2\rlwd}{0pt}}
\def\pigpen#1#2#3#4{\kern1pt% FOUR ARGUMENTS ARE LEFT, TOP, RIGHT, BOTTOM STROKES
\brlwd=#4\rlwd\relax%
\trlwd=#2\rlwd\relax%
\lrlwd=#1\rlwd\relax%
\rrlwd=#3\rlwd\relax%
\stackengine{\dimexpr\rlln-\rlwd}{%
\stackengine{0pt}{\bstr}{\lstr\gap\rstr}{O}{c}{F}{F}{L}%
}{\tstr}{O}{c}{F}{F}{L}\kern1pt%
}
\begin{document}
$x\pigpen0011 \pigpen1011 \pigpen1001 \pigpen0111
\pigpen1111 \pigpen1101 \pigpen0110 \pigpen1110
\pigpen1100 \pigpen1010 \pigpen0101 y$
\end{document}
Best Answer
The
manfnt
package offers\mancube
and\manimpossiblecube
:Those commands won't directly work in math mode, but you can use a
\mbox
; something like this:Of course, you could define a command if you are going to use the cube several times: