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.}}


1 Answer 1




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

  • And that's called a quick response! -- At the velocity of light! :-)
    – user11232
    Jan 5, 2013 at 16:10
  • Thanks a lot, that works beautifully. Much appreciated!
    – Mara Jade
    Jan 5, 2013 at 16:22
  • 1
    @MaraJade \newcommand{\note}[1]{\fbox{\parbox{\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax}{#1}}} is probably better. I’d throw in an additional \noindent too. Jan 5, 2013 at 18:17
  • 1
    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\fboxrule\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. Jan 5, 2013 at 18:30

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.