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

I have a feeling that this is a profoundly stupid question but I cannot seem to solve it myself.

I am trying to write an own macro to create a boxed paragraph. The code works fine in-line but when I try to define the command it just creates a small box in the same place that I wrote the command. My codes are below. I am pretty much a complete newbie at this and any help would be greatly appreciated.

\fbox{\parbox{\linewidth}{Inline this works perfectly.}}

share|improve this question
Welcome to TeX.sx! – Torbjørn T. Jan 5 '13 at 16:06
up vote 13 down vote accepted



The content of the parbox is always specified by {} so empty.


will make an empty box from \note before seeing hello.

You want hello to be an argument of \note so

share|improve this answer
And that's called a quick response! -- At the velocity of light! :-) – Harish Kumar Jan 5 '13 at 16:10
Thanks a lot, that works beautifully. Much appreciated! – Mara Jade Jan 5 '13 at 16:22
@MaraJade \newcommand{\note}[1]{\fbox{\parbox{\dimexpr\linewidth-2\fboxsep-2\fboxrule\rel‌​ax}{#1}}} is probably better. I’d throw in an additional \noindent too. – Qrrbrbirlbel Jan 5 '13 at 18:17
Yes do as @Qrrbrbirlbel says, I addressed the programming question about how to define a macro with arguments but \newcommand{\note}[1]{\noindent\fbox{\parbox{\dimexpr\linewidth-2\fboxsep-2\fbo‌​xrule\rel‌​ax}{#1}}} is a better definition in this case as otherwise the box will not fit on the line as the inner box is already full width and then outer box has padding and a rule on either side, and TeX may add paragraph indentation at the start. – David Carlisle Jan 5 '13 at 18:30

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.