☰ Click for Table of Contents
BookWiki Documentation
Copyright 2026
Rance D. Necaise

Code Blocks

The code environment is used to include raw unhighlighted source code on a page.

source module
\begin{code}[style=cssnames]
   source code  
\end{code}
Used to display raw unhighlighted code using a darker monospaced font similar to the one used with the other syntax highligting directives. The default is to display the code in a box with a light gray background.
Argument:
style

The name of one or more style classes that are appended to the class name of the code block. This allows for additional styling beyond the default. The current styles defined for a code block are provided below:

ValueDescription
plainuse a plain lighter courier font than the normal source code font.
Plugin:  CodeBlock
Example
source
  1. \begin{code}
  2. float avg;
  3. avg = (grade1 + grade2 + grade3) / 3.0;
  4.  
  5. if(avg >= 90)
  6.   printf("Excellent Work!\n");
  7.  
  8. printf("Your average is %0.2f\n", avg);
  9. \end{code}
float avg;
avg = (grade1 + grade2 + grade3) / 3.0;

if(avg >= 90)
  printf("Excellent Work!\n");

printf("Your average is %0.2f\n", avg);
results
  August 20, 2026 at 02:13 PM