Code: Select all
\def\comment{\colorbox{yellow}}{}
Code: Select all
\def\comment{\colorbox{yellow}}{}
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
An exampleJohannes_B wrote:In order to help you, we need more information. What is going to happen, if the text is longer than one line, or longer than one paragraph.
Can you supply those info in form of a compilable minimal example?
Code: Select all
\documentclass{minimal}
\usepackage{color,comment}
\begin{document}
\def\comment{\colorbox{yellow}}{}
In the compiled output text in curly brackets extends beyond the right margin
\comment{ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZz}
\end{document}
I have explored both. Prefer a simple bold text in yellow background that wraps normally
Code: Select all
\documentclass{article}
\usepackage[width=5.05cm]{geometry}
\usepackage{color,soul}
\begin{document}
\noindent\hl{Highlighting} text feels good.
You can draw attention of people to a \hl{word} or perhaps
\hl{even a whole sentence that spans across multiple lines
in such a way that hyphenation etc. are not affected.}
\end{document}
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis