I am making a yes or no question inside a box and I have difficulty on creating the command for it. Would you mind to help me make something that will output this:
[Tex/LaTex] Are three boxes inside a box possible
boxescolumnsnesting
boxescolumnsnesting
I am making a yes or no question inside a box and I have difficulty on creating the command for it. Would you mind to help me make something that will output this:
Best Answer
As I said in Define a command (possibly recursively) to wrap text in a command n times, when it comes to drawing boxes,
tikz
is the way to go.Here is a macro version that accepts four mandatory parameters for each of the text elements. So with
you get your plain vanilla box:
However, it also accepts two optional parameters that allow you to style the outer and inner boxes. This illustrates just a few of the various options you can tweak where you can adjust alignment, draw and fill colors:
Box Width:
To control the width of the box, you can add the
text width=<length>
option:Horizontal Spacing between Boxes:
A macro has been defined to specify the horizontal spacing. It is currently defined to
\hfill
which will even space out the three boxes. You can adjust this if you do prefer them separated by a fixed amount of space. So with this defined asyou get:
Note that a fixed distance for horizontal separation requires some care as illustrated by the 4th box above.
Also, this necessitated a slightly different use mode in terms of how the alignment of the first line is controlled: Instead of the
tikz
options I used a\fill
on the appropriate side.Code: Boxes Evenly Distributed
Code: Fixed Horizontal Spacing