# Creating a note section

I'm wondering how I can create a note section like in the picture with two lines. I would love if I can use it as a command in LaTeX like \note{some text}.

• Could post what you've tried? – Bernard Feb 10 at 12:01
• What does your question have to do with biblatex or marginnote? – Bernard Feb 10 at 12:12
• So far I have tried using  \begin{lstlisting} Note: Some text end{lstlisting}  – user3874252 Feb 10 at 12:16
• Using what, exactly? – Bernard Feb 10 at 12:20
• The lstlisting package. But that package is more for larger amount of code and have it formatted to display a gray background. – user3874252 Feb 10 at 12:27

An inevitable tcolorbox solution, providing a lot of configuration possibilities. The default shift of the Note: is set to 1.5cm, but this can be changed by the option nodeshift=...

\documentclass{article}

\usepackage{blindtext}

\usepackage[most]{tcolorbox}

\makeatletter
\NewDocumentCommand{\mynote}{+O{}+m}{%
\begingroup
\tcbset{%
noteshift/.store in=\mynote@shift,
noteshift=1.5cm
}
\begin{tcolorbox}[nobeforeafter,
enhanced,
sharp corners,
toprule=1pt,
bottomrule=1pt,
leftrule=0pt,
rightrule=0pt,
colback=yellow!20,
#1,
left skip=\mynote@shift,
right skip=\mynote@shift,
overlay={\node[right] (mynotenode) at ([xshift=-\mynote@shift]frame.west) {\textbf{Note:}} ;},
]
#2
\end{tcolorbox}
\endgroup
}
\makeatother

\begin{document}

\blindtext

\mynote{Brontosaurs are thin at one end, thick in the middle and thin again at the other end}

% Exaggerated example
\mynote[noteshift=4cm,colback=green!40]{Brontosaurs are thin at one end, thick in the middle and thin again at the other end}

\end{document}

• The king of tcolorbox :-). Very nice and I have appreciated also your answer. – Sebastiano Feb 10 at 20:06
• Thank you. That was the best solution for me! – user3874252 Feb 14 at 14:49
• @user3874252: You're welcome. Happy TeXing... but please don't use the green color example ;-) – Christian Hupfer Feb 14 at 18:39
• @ChristianHupfer Haha, yeah it will be colorless but I liked how you fixed the margins real nice. Thank you, again! – user3874252 Feb 15 at 12:32

Is this something that you were looking for ?

Then you can use the new command \notte derived from the environment quote:

\documentclass{article}
\usepackage{lipsum}

\newlength{\Lnote}
\newcommand{\notte}[1]
\settowidth{\Lnote}{\textbf{Note:~}}
\begin{quote}
\rule{\dimexpr\textwidth-2\leftmargini}{1pt}\\
\mbox{}\hspace{-\Lnote}\textbf{Note:~}%
#1\\[-0.5ex]
\rule{\dimexpr\textwidth-2\leftmargini}{1pt}
\end{quote}

\begin{document}
\lipsum[3]

\notte{To create a note section like in the picture, use the command \texttt{notte}.}

\lipsum[4]

\notte{Another note}
\end{document}

• Very good and I have appreciated your work. – Sebastiano Feb 10 at 12:59
• @Sebastiano Thanks. However, I was wondering how to set the left and right margins differently-- \leftmargini controls the left margin within a quote very much as its right margin too... and there apparently seems to be no \rightmargini ! – Partha D. Feb 10 at 13:05

A solution with tabularx, makecell and linegoal:

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage[svgnames, table]{xcolor}
\usepackage{tabularx, makecell, linegoal}

\usepackage{lipsum}% only for example text

\Xhline{1pt}
\rowcolor{WhiteSmoke!80!Lavender}#1 \\
\Xhline{1pt}
\end{tabularx}}

\begin{document}
\sffamily
\lipsum[2]

\mynote{Internal pullup resistors are enabled on the MSP430F20xx to support l\textsuperscript{2}C communication}

\end{document}


I would suggest you try footnote. There should be an understanding in the text, as to the note points to which text (like references). Here is a sample code:

\documentclass{article}
\begin{document}
Hello World
This is text with a note.\footnote{This is the note text.
Here it is at the bottom of the page.}
\end{document}