TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 7 down vote accepted



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.

share|improve this answer
That worked, thank you. I assumed the slash was implicit. Will accept answer once it lets me. – Saladin Akara Nov 12 '11 at 13:53
@SaladinAkara: You're welcome. It seemed strange to me too the first time! – qubyte Nov 12 '11 at 13:55
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 '11 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:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.