Skip to content

\Highlight in minipage extend over the width of the minipage #22

Description

@quark67

MWE:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usetikzmarklibrary{highlighting}

\begin{document}
\noindent\begin{minipage}{5cm}
The sun was shining on the sea, shining with all its might.
\StartHighlighting[fill=cyan!50]
And this was very odd because it was the middle of the night.
\StopHighlighting
The moon was up there sulkily because she thought the sun had no
business to be there after the day was done.
\StartHighlighting[fill=magenta!50,/tikz/highlighter/left margin=0pt,
/tikz/highlighter/right margin=0pt,
/tikz/highlighter/initial offset=0pt,
/tikz/highlighter/final offset=0pt,
]
‘‘It’s very rude of him,’’ she said, ‘‘to come and spoil the fun.’’
\StopHighlighting
\noindent The sun was shining on the sea, shining with all its
might.
And this was very odd because it was the middle of the night.
\StartHighlighting[fill=yellow!50]
The moon was up there sulkily because she thought the sun had no
business to be there after the day was done\StopHighlighting.
‘‘It’s very rude of him,’’ she said, ‘‘to come and spoil the fun.’’
\end{minipage}
\end{document}

As we see with magenta,

/tikz/highlighter/left margin=0pt,
/tikz/highlighter/right margin=0pt,
/tikz/highlighter/initial offset=0pt,
/tikz/highlighter/final offset=0pt,

is not enough.

Image

By the way, if instead the four lines above, I use/tikz/highlighter/margin=0pt, this gives this error:

Package pgfkeys Error: I do not know the key '/tikz/left margin', to which you passed '0pt', and I am going to ignore it. Perhaps you misspelled it.

Yes, /tikz/highlighter/margin gives an error related to /tikz/left margin, despite the manual speak about the margin key:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions