Highlighting a paragraph in LaTeX
edit: see Highlighting a paragraph in LaTeX #2 for a better solution to this.
When writing a text in Microsoft Word I like to highlight sections with a "neon marker" effect to have a clear visual guidance which parts still need some reviewing or for example need additional citations added. So basically this is how it should look in a LaTex generated PDF as well:
Googling for latex highlight paragraph blog posts like e.g. devdaily.com suggest the following approach to highlight a paragraph:
Add the following to your preamble:
\usepackage{color} \newcommand{\hilight}[1]{\colorbox{yellow}{#1}}To highlight text in the body of your document, use
\hilight{this is some highlighted text}There is a problem with the previous method is that the color box does not wrap properly. Here's a much easier and robust way of doing this
\usepackage{soul}To highlight text in the body of your document, use
\hl{this is some highlighted text}
Unfortunately this approach works only if the highlighted paragraph contains no other nested block elements like a \citep tag. If you, like me, use such elements in the text you want to highlight you will get error messages which makes the Soul package quite unusable for the original purpose. Unfortunately I cant offer you a direct solution for this problem, but at least in my case highlighting the text itself (instead of marking up the background of the text) did its job.
For this use Preamble:
\usepackage[usenames,dvipsnames]{color}
\newcommand{\markup}[1]{{\color{Cerulean}{#1}}}
In the text: \markup{whatever text including \citep[p. 5f]{Brügmann.2010} lorem ipsum bla bla}
which results in:
If this causes an error of type option clash for package color you can comment out the /usepackage[][... line and simply include the dvipsnames switch in your global \documentclass options e.g.:
\documentclass[a4paper,oneside,dvipsnames]{book}
Finally for changing the color style in the /markup command see WikiBooks:LaTeX/Colors.
Attachments
-
paragraph-highlight.png
(10.8 KB) - added by hkbruegm
4 months ago.
-
paragraph_markup.png
(73.0 KB) - added by hkbruegm
4 months ago.
rss





Comments
No comments.