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:
Value Description plain use a plain lighter courier font than the normal source code font.
Plugin: CodeBlock
Example
source
- \begin{code}
- float avg;
- avg = (grade1 + grade2 + grade3) / 3.0;
- if(avg >= 90)
- printf("Excellent Work!\n");
- printf("Your average is %0.2f\n", avg);
- \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