\(\definecolor{frog}{rgb}{1,0,0}\) \(\newcommand{\dx}{\,\text{d}x}\) \(\newcommand{\du}{\,\text{d}u}\) \(\newcommand{\dy}{\,\text{d}y}\) \(\newcommand{\dt}{\,\text{d}t}\)

6 Chapter 6

6.1 Invisible text

I have a Quarto extension Invisible text extension to make hiding text easy. Mostly for use in gapped notes, or perhaps handouts.

It implemented by simply setting text to fully transparent (and not selectable). Screenreaders will be able to see it, and they will also get informative notifications about the visibly hidden text. In LaTeX/PDF it is rendered as white text.

Just install it as any other extension via

quarto add david-hodge/invis

and then you can use it via usage of the following shortcodes.

6.1.1 Simple hiding

{{< invis start >}}
This starts invisibility
{{< invis end >}}
This ends invisibility

By default these are designed to hide a single block/element on a page. It can hide a single equation, a single word, a single line or text, etc.. However it cannot hide multiple paragraphs or more complex elements.

6.1.2 Hiding larger elements

To hide more complex elements, use the block extra paramater.

{{< invis start block >}}
This starts invisibility for a large element
{{< invis end block >}}
This ends invisibility for a large element

There are limitations for complex multiple blocks (see below).

6.1.3 Examples

This first sentence is fully visible.

Note: the following content is visually hidden. This second sentence is fully visible. End of visually hidden content.

This third sentence is fully visible.

Warning

I don’t imagine you would wish, but should you wish to hide some fundamental Quarto object like a code block and the resulting output you are recommended to use the built-in features like setting echo: false on the code block, or read about Conditional Formatting in Quarto.

You can use this invis extension to hide large blocks of content in the HTML, but for such elements they will likely appear in the PDF, since all we are doing in the PDF is setting standard text as white, and code and plots are not standard text.

Note: the following content is visually hidden.
plot(cars)
Cars plot
Figure 6.1: This is the caption
End of visually hidden content.

The code and output plot above are fully hidden in the HTML. Likely fully visible in the PDF. If you already have a favourite way of hiding in LaTeX this is likely usable, but too complex for this guide.