Skip to content

How to present code

Rodolfo Viana edited this page Oct 18, 2026 · 1 revision

Code blocks keep indentation and add syntax highlighting. Step highlights let you draw attention to different lines as you explain them, without duplicating the slide.

1. Add the code

Code is inserted from the toolbar and edited in Format > Code. The screenshot also marks the step-highlighting field used in the next section.

A Python code block, with the Code toolbar button marked as 1, the source field as 2 and Step highlights as 3

  1. Click Code in the toolbar to insert a code object.
  2. Paste or type the code in the source field.

Choose its Language and Size, and turn on Line numbers if they help the explanation. Optionally set a Title, such as a file name or caption.

For example, use this short Python function:

def water_for(coffee_grams):
    ratio = 16
    water_grams = coffee_grams * ratio
    return water_grams

The code is displayed, not executed. Resize the object and adjust the text size until every line fits comfortably.

2. Highlight lines in steps

In Step highlights (marked 3 in the screenshot), enter 1|2-3|4. The line groups are separated by |, ranges use -, and individual lines within a group use commas, such as 2,4.

  1. Press Shift+F5 to start from this slide.
  2. The first group highlights line 1. Advance to highlight lines 2–3, then advance again for line 4.
  3. Go back through the builds to revisit a group.

Leave Step highlights empty for ordinary syntax highlighting. You can also give the whole code object a Build in effect in the Animate inspector. Rehearse the combination so the block appears before you discuss its individual lines.

3. Choose the highlighting colors

Document > Code Blocks > Highlighting chooses Monokai or Zenburn for the presentation's code blocks. This is separate from the slide theme.

Step highlights work in web exports. A PDF shows a static slide; use a web export when readers need to follow the steps. See How to export and share a presentation.

Clone this wiki locally