When using \fbox on its own, it creates a border around the text. However, I want to create a new command so I can create a boxed code example. Written 'inline', it works as expected:


However, when I put it into a new command:


It doesn't apply the border, nor does it apply the font and sizing.

I am completely new to LaTeX, so any help will be much appreciated in identifying what the problem is.

2 Answers 2




You missed a backslash.


As Herbert pointed out in his answer, a couple of the curly braces are not required, since \scriptsize is a switch and takes no arguments. i.e.


is sufficient since the script sized text is contained within the scope of fbox.

  • That worked, thank you. I assumed the slash was implicit. Will accept answer once it lets me. Nov 12, 2011 at 13:53
  • @SaladinAkara: You're welcome. It seemed strange to me too the first time!
    – qubyte
    Nov 12, 2011 at 13:55
  • 2
    As pointed out by Herbert, the curly brackets to the right of \scriptsize don't do anything since it's a switch. The \fbox is really what is containing it, and in general you'd want to do it like this: {\scriptsize stuff}.
    – qubyte
    Nov 12, 2011 at 14:06

use it this way:


\scriptsize is a switch and not a command with an argument. A command has to befined with a backslash and an environment by its name without a backslash:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .