I want to make a box for my daughter in order to fill in the blank. But it is not nice. How can I repair the boxes?

Asked
Active
Viewed 1,221 times
1
nox
- 4,160
- 12
- 26
minhthien_2016
- 9,467
1 Answers
5
Here is a suggestion:
\documentclass{article}
\usepackage{amsmath}
\newcommand{\pbox}[1]{\boxed{\phantom{#1}}}
\begin{document}
$ \pbox{2015} + 2016 = 4031 $
\medskip
$ \pbox{1} + \pbox{2} + \pbox{3} = 6 $
\medskip
$ \pbox{f(x)} = ax^2 + bx + c $
\medskip
$ \dfrac{6}{10} = \dfrac{\pbox{3}}{5} $
\end{document}
The contents is set as a \phantom inside a \boxed (from amsmath).
Werner
- 603,163
-
-
@Werner HOw can I simplify this line
$ 12\,\, \pbox{>} \,\,5 + 6.$? – minhthien_2016 Dec 28 '16 at 02:00 -
-
@Werner Can I get a square box? If I use
$ 12 \mathbin{\pbox{>}} 5 + 6 $not nice. – minhthien_2016 Dec 28 '16 at 04:00 -
@toandhsp: Try with
$ 12 \mathbin{\pbox{\vphantom{>}\rule{1ex}{0pt}}} 5 + 6 $. – Werner Dec 28 '16 at 07:08 -
And how about $ 12 \mathbin{\pbox{\vphantom{=}\rule{1ex}{0pt}}} 5 + 6 $? – minhthien_2016 Dec 28 '16 at 07:11
-
=does not have the same height as<or>, so stick to the latter for a square relation. Alternatively, just use$ 12 \mathbin{\boxed{\phantom{\rule{1ex}{1.3ex}}}} 5 + 6 $. – Werner Dec 28 '16 at 07:20 -
I really like this approach. The phantom inside the box doesn't seem to respond to sizing cues; for example, the box still appears at full size when it's in an exponent. Do you know of any way to make the phantom resize like usual? – Vectornaut Mar 29 '23 at 19:02
-
1@Vectornaut: Try this version. It uses
\mathpaletteto bring over the math style, since\boxeddoesn't do that by itself; example output. – Werner Mar 29 '23 at 19:42 -

\vcenteroption. There are other ways, but I think this suffices. – nox Dec 28 '16 at 00:52\[\vcenter{\hbox{\rule{0.35cm}{0.35cm}}} + 2016 = 2017 \]. – minhthien_2016 Dec 28 '16 at 01:20