Creating a note section
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]
{\addtolength{\leftmargini}{4em}
\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}
\addtolength{\leftmargini}{-4em}}
\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}
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}
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
\newcommand{\mynote}[1]{\medskip\par\textbf{\small Note}\quad\setlength{\extrarowheight}{2pt}\begin{tabularx}{\linegoal}{X}
\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}