Ok, let me go through your (first) redefinition to see what happens:
1 \@ifundefined{comment}{}{% only do this if the comment environment has been defined 2 \renewenvironment{comment}[1]% redefining a 'comment' environment with one mandatory argument 3 {\begingroup\marginpar{\bgroup
Here's how LaTeX thinks about what you told him:
\begin{comment}{xyzzy}% <
Note that xyzzy is a required argument ( #1 ). The contents of the medium (" This is the ...") are inserted between lines 3 and 4.
If you write the following in your document:
\begin{comment}% <
Then LaTeX will take the first token as a required argument. In this case, the first token is T , the first character of the contents of the medium. Thus, the letter T will be placed in the field, and the rest of the text will be displayed in a regular paragraph.
So, in order to achieve what you want, the comment environment does not need any arguments. What we will do is create a field, put the contents of the environment into it, and then put this field in the field.
Before we begin, if you include this code in the preamble of the document, you will need to wrap it all in \makeatletter and \makeatother , since we will use commands with signs ( @ ) in their names.
First create a field to store the material in:
\newsavebox{\marginbox}% contains the contents of the comment environment
Then we will start defining the comment environment. We set the start and end commands of the environment to \relax . This way our \newenvironment team will be guaranteed.
\let\comment\relax% removes and previous definition of \begin{comment} \let\endcomment\relax% removes any previous definition of \end{comment}
From this perspective, we can define our new comment environment:
\newenvironment{comment}{% \begin{lrbox}{\marginbox}% store the contents of the environment in a box named \marginbox \begin{minipage}{\marginparwidth}% create a box with the same width as the marginpar width \footnotesize% set any font or other style changes you'd like }{% the following lines are for the \end{comment} command \end{minipage}% close the minipage \end{lrbox}% close the box \marginpar{\usebox{\marginbox}}% typeset the box in the margin }
Now in your document you can enter:
\begin{comment} This is a comment that gets printed in the margin. \end{comment}
So, just for the convenience of copying and pasting, what a complete document looks like:
\documentclass{article} \makeatletter \newsavebox{\marginbox}% contains the contents of the comment environment \let\comment\relax% removes and previous definition of \begin{comment} \let\endcomment\relax% removes any previous definition of \end{comment} \newenvironment{comment}{% \begin{lrbox}{\marginbox}% store the contents of the environment in a box named \marginbox \begin{minipage}{\marginparwidth}% create a box with the same width as the marginpar width \footnotesize% set any font or other style changes you'd like }{% the following lines are for the \end{comment} command \end{minipage}% close the minipage \end{lrbox}% close the box \marginpar{\usebox{\marginbox}}% typeset the box in the margin } \makeatother \usepackage{lipsum}% just provides some filler text \begin{document} Hello, world! \begin{comment} This is a comment that gets printed in the margin. \end{comment} \lipsum \end{document}