Skip to content

Code Block Insertion

Liii STEM supports source-code typesetting via dedicated code block environments.

As shown above, this is Python code in a Python code-block environment. Liii STEM automatically handles fonts, syntax colors, and indentation.

Enter a Code Block Environment

You can enter code blocks in multiple ways:

  • In the mode toolbar, click </> (Insert computer program) -> Code block.
    • Choose Plain Text to enter verbatim code
    • Or directly choose cpp code, scm code, shell code, etc.

When focus is inside a verbatim code environment, the focus toolbar will indicate it.

  • After enabling Python/Scala/Goldfish packages, you can also insert python code / scala code / goldfish code directly.

If the package is not enabled, you will see a prompt like below and can click Activate.

Switch code-block language variant

After entering a code block, use Structured variant in the focus toolbar to switch language-specific block types. Existing code will be re-typeset accordingly.

Typeset code

After selecting the proper code-block environment, you can edit code directly. Liii STEM will handle style and indentation automatically.

Add line numbers

To enable line numbering, first enter the \listing environment.

Then insert a code block inside this environment to get automatic line numbers.