3

This is what I have:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pbox}
\begin{document}
$A= \pbox[center][1cm]{3cm}{B}$
\end{document}

When generating the pdf it goes like "A = " without any box, what am I doing wrong?

this is what it looks like,

the result

and this is what I'm looking for, this is what I look for, if anything come up to one of you

  • $A= \pbox[c]{3cm}{B}$ works as expected. I cannot find the syntax you propose in the manual. – user194703 Mar 9 at 22:38
  • @Schrödinger'scat I added an image, I'm using VerbTex in android, could it be the package I downloaded? the image looks annoying, sorry for not cropping. – Bruno Stühler Mar 9 at 22:44
  • @Sebastiano I was using \fbox, but it wouldn't let me resize it, and \framebox isn't aligned with the line, it grows vertically.. so pbox would have centered. – Bruno Stühler Mar 9 at 22:46
  • 1
    Your's is a typical XY-question. The answer to your present question is “replace [center] with [c] (or remove it altogether). The answer to the question you have in your mind is obviously very different. – egreg Mar 9 at 22:54
  • 1
    Nothing in the manual of pbox suggests that it is able to make frames. The frames you see in it are just to display the code used for producing the result shown at the left. – egreg Mar 9 at 23:20
3

For this you do not need any package. For the numbers in circles you can use pifont, though. The usage of the \NumBox command is explained in the example code.

\documentclass{article}
\usepackage{pifont}
\newcommand\NumBox[3][1.8em]{\fbox{\begin{tabular}{@{}p{#3}@{}}
\ding{\the\numexpr171+#2}$\vcenter{\vspace{#1}}$\\
\end{tabular}}}
\begin{document}
\subsection*{Usage}
\texttt{\textbackslash NumBox[$\langle\mbox{height}\rangle$]\{$\langle\mbox{number}\rangle$\}%
\{$\langle\mbox{width}\rangle$\}}

\bigskip


\noindent
$\NumBox{1}{3cm}\le x\le \NumBox{2}{3cm}$

\bigskip

\noindent
$\NumBox[3em]{3}{3cm}\le y\le \NumBox[3em]{4}{4cm}$

\end{document}

enter image description here

There is of course also the possibility to use circledsteps, which opens the possibility of using pgf keys. The syntax becomes then much more intuitive (IMHO). (Of course, one could then also draw the box with pgf...)

\documentclass{article}
\usepackage{circledsteps}
\pgfkeys{/Bruno/.cd,width/.initial=3cm,height/.initial=1.8em}
\newcommand\NumBox[2][]{\pgfkeys{/Bruno/.cd,#1}
\fbox{\begin{tabular}{@{}p{\pgfkeysvalueof{/Bruno/width}}@{}}
\Circled{#2}$\vcenter{\vspace{\pgfkeysvalueof{/Bruno/height}}}$\\
\end{tabular}}}
\begin{document}
\subsection*{Usage}
\texttt{\textbackslash NumBox[$\langle\mbox{keys}\rangle$]\{$\langle\mbox{number}\rangle$\}}

\bigskip


\noindent
$\NumBox{1}\le x\le \NumBox{2}$

\bigskip

\noindent
$\NumBox[height=3em]{3}\le y\le \NumBox[height=3em,width=4cm]{4}$

\end{document}

enter image description here

| improve this answer | |
  • I'm using pifont also :-) +1 – Sebastiano Mar 9 at 23:15
  • Oh my xD wish I could hug you friend, thank you for your time, that's amazing. btw, I'm building a question paper sorted by subject, so I can study for an entrance exam :) – Bruno Stühler Mar 9 at 23:19
  • @BrunoStühler You have given the green light to the best answer. I'm much simpler because I'm inexperienced. – Sebastiano Mar 9 at 23:33
  • @Sebastiano yeah xD it's a superb resolution from Schrödinger, straightforward as well, we should both absorb – Bruno Stühler Mar 9 at 23:38
  • 1
    @BrunoStühler I am a humble user and give to Caesar what is Caesar's. – Sebastiano Mar 9 at 23:39
3

I must admit that I am not as good as many other users ... but after many attempts I reached the goal ... wow ... and I also have the numbers aligned ahaahah.

enter image description here

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc} 
\usepackage{amsmath,amssymb}
\usepackage{pifont}
\newcommand{\largebox}{\phantom{\begin{bmatrix}
    x_{11}       & x_{12} \\
    x_{21}       & x_{22} 
    \end{bmatrix}}}
\begin{document}
\[\boxed{\text{\ding{172}}\largebox} \leqq x \leqq \boxed{\text{\ding{173}}\largebox}\]
\[\boxed{\text{\ding{174}}\largebox}\leqq y \leqq \boxed{\text{\ding{175}}\largebox}\]
\end{document}
| improve this answer | |
  • Yes that looks neat.. but it hasn't a height-width option has it? thank you. – Bruno Stühler Mar 9 at 22:54
  • @BrunoStühler No no please. I'm searching to change my answer or delete it. I'm all for fairness. I'm trying to create a big box that creates your final image. Could you please remove the green tick? Thank you. – Sebastiano Mar 9 at 23:01
  • 1
    I've removed the green tick :) – Bruno Stühler Mar 9 at 23:09
  • 1
    It's amazing, I shall study both formats :) and well, knowledge in such matters.. I can tell you hehe it's always impressive.. – Bruno Stühler Mar 9 at 23:33

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.