1

Sorry if this is similar to previous questions, but I need to check if this is the best solution. My issue is that I am writing a document which contains HTTP messages for example of a snippet:

   message-header = field-name ":" [ field-value ]
   field-name     = token
   field-value    = *( field-content | LWS )
   field-content  = <the OCTETs making up the field-value
                    and consisting of either *TEXT or combinations
                    of token, separators, and quoted-string>

much like when using this website the message appears in a grey box is there a best practice way to do this in latex? I have found the following link: Box or sidebar for additional text and was wondering whether this is the best solution. I was also hoping to omit the text from a wordcount if possible. Any ideas would be greatly appreciated - I am hoping for the following kind of effect: enter image description here

1 Answers1

5

Consider using tcolorbox's listings option:

enter image description here

\documentclass{article}

\usepackage[listings]{tcolorbox}

\begin{document}

\begin{tcblisting}{listing only}
message-header = field-name ":" [ field-value ]
field-name     = token
field-value    = *( field-content | LWS )
field-content  = <the OCTETs making up the field-value
                 and consisting of either *TEXT or combinations
                 of token, separators, and quoted-string>
\end{tcblisting}

\end{document}
Werner
  • 603,163