Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a question similar to this one:

How to mark book paragraphs as note, warning, tip etc.?

I'd like to have my paragraph indented and the text "note:" appear just before it. Ideally this would be a kind of macro that I could reuse anywhere in my text.

The rendered text should be similar to this:

Duis porttitor nisi et orci pellentesque feugiat. Aenean id
turpis vel purus tincidunt sodales. Class aptent taciti
sociosqu ad litora torquent per conubia nostra, per inceptos
himenaeos. Cras semper dui et nulla feugiat at convallis dolor
tincidunt. Lorem ipsum dolor sit amet, consectetur adipiscing
elit.

Note:  Lorem ipsum dolor sit amet, consectetur adipiscing elit.
       Aenean et erat quis turpis tristique ultricies at in est.
       Nunc quis volutpat neque. Nunc sit amet turpis nec risus
       vehicula tristique ac ac risus. Cras interdum vehicula
       metus. Nulla facilisi. Duis faucibus porttitor elit
       mattis venenatis.

By the way, I'm using the "book" documentclass.

share|improve this question
add comment

2 Answers 2

up vote 8 down vote accepted

You can use the package enumitem and define a list that you can use for notes such as the following:

\documentclass{article}

\usepackage{enumitem}

\newlist{notes}{enumerate}{1}
\setlist[notes]{label=Note: ,leftmargin=*}

\begin{document}

Duis porttitor nisi et orci pellentesque feugiat. Aenean id turpis vel
purus tincidunt sodales. Class aptent taciti sociosqu ad litora
torquent per conubia nostra, per inceptos himenaeos. Cras semper dui
et nulla feugiat at convallis dolor tincidunt. Lorem ipsum dolor sit
amet, consectetur adipiscing elit.
\begin{notes}
\item Lorem ipsum dolor sit amet, consectetur adipiscing elit.  Aenean
  et erat quis turpis tristique ultricies at in est.  Nunc quis
  volutpat neque. Nunc sit amet turpis nec risus vehicula tristique ac
  ac risus. Cras interdum vehicula metus. Nulla facilisi. Duis
  faucibus porttitor elit mattis venenatis.
\end{notes}

\end{document}

Output of example

By using enumitem and defining the note as an enumeration it will be easy to make it so that every note gets numbered if you want that. You simply change the setlist macro to

\setlist[notes]{label=Note \arabic*:, resume, leftmargin=*}

and this way notes will be numbered as "Note 1:", "Note 2:", "Note 3:", etc.

Finally, if you find the syntax

\begin{notes}
  \item Lorem ipsum
\end{notes}

stupid since you will never include more than one \item you can define a macro that includes the \item

\newenvironment{note}[1]{\begin{notes}\item #1}{\end{notes}}

so that you instead make notes with

\begin{note}
  Lorem ipsum
\end{note}
share|improve this answer
    
Yes, it renders exactly what I expect! Thanks a lot! –  ogregoire Jan 17 '12 at 15:30
    
@ogregoire Good to hear. I have updated my answer to include alternatives. –  N.N. Jan 17 '12 at 15:43
    
Great additions, so I don't have to write \item everywhere! –  ogregoire Jan 17 '12 at 15:56
add comment

The primitive TeX command hangindent can be used for this purpose.

\documentclass{article}
\parindent0pt

\begin{document}
Duis porttitor nisi et orci pellentesque feugiat. Aenean id
turpis vel purus tincidunt sodales. Class aptent taciti
sociosqu ad litora torquent per conubia nostra, per inceptos
himenaeos. Cras semper dui et nulla feugiat at convallis dolor
tincidunt. Lorem ipsum dolor sit amet, consectetur adipiscing
elit.

\hangindent3em
Note:  Lorem ipsum dolor sit amet, consectetur adipiscing elit.
       Aenean et erat quis turpis tristique ultricies at in est.
       Nunc quis volutpat neque. Nunc sit amet turpis nec risus
       vehicula tristique ac ac risus. Cras interdum vehicula
       metus. Nulla facilisi. Duis faucibus porttitor elit
       mattis venenatis.

\end{document}

You can also define a command to handle it more semantically either with LaTeX or TeX,

\long\def\note#1\par{%
\leavevmode
\hangindent3em Note: #1}

You can then use it as follows:

\note
       Lorem ipsum dolor sit amet, consectetur adipiscing elit.
       Aenean et erat quis turpis tristique ultricies at in est.
       Nunc quis volutpat neque. Nunc sit amet turpis nec risus
       vehicula tristique ac ac risus. Cras interdum vehicula
       metus. Nulla facilisi. Duis faucibus porttitor elit
       mattis venenatis.

No need to be enclosed in brackets, as long as you leave a line at the end to ensure that there is a paragraph end.

share|improve this answer
    
This seems to render improperly when I have several paragraphs in my note. But it's nice to see anyone else helping :) Also, the "Lorem" and the next line's "Aenean" will not be properly aligned. –  ogregoire Jan 17 '12 at 15:34
    
@ogreigoire The alignment works for me. This can only be used for one paragraph, as stated in the question. It is always good to know how TeX typesets. Adding for example \hangafter will affect the number of lines being indented. For multiple paragraphs one has to use \everypar and the code is somewhat longer. –  Yiannis Lazarides Jan 17 '12 at 15:43
1  
if there's more than one paragraph, the first could be "ended" with \newline and a suitable \hspace* added at the beginning of the next line. latex wouldn't detect this as a paragraph, so the indentation wouldn't be lost. (of course, using enumitem is more elegant, and wouldn't give rise to possible "widows" or "orphans" in case of an unfortunately placed page break.) –  barbara beeton Jan 17 '12 at 16:00
1  
@egregoire If you remove the \parindent0pt it will render the same. Don't worry about the +1, if you didn't find the answer useful you don't have to upvote. This is what the voting system is all about. –  Yiannis Lazarides Jan 17 '12 at 16:08
1  
@Yiannis -- the problem with uneven indentation can be fixed by a slight change in the definition: \long\def\note#1\par{\leavevmode \hangindent3em \hbox to 3em{Note:\hss}\ignorespaces#1}. for a subsequent paragraph, one could define a similar \phantomnote with the box containing just \hfil. –  barbara beeton Jan 17 '12 at 20:31
show 1 more comment

Your Answer

 
discard

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.