summaryrefslogtreecommitdiff
path: root/misc/test-tex
blob: 9ba8dfcf1c5e8f62124752ac00029c09d6f25137 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
@start \vspace{-0.5\unit}{\footnotesize\italic{@@:}}\vspace{-1\unit}\n\begin{codeblock}
@add \vspace{-0.5\unit}{\footnotesize\italic{+ @@:}}\vspace{-1\unit}\n\begin{codeblock}
@end \end{codeblock}
@ref §\textrm{\italic{(@@)}}§

\documentclass[debug]{microstructure}

\author{DistressNetwork°}
\lstset{escapechar=§}

\begin{document}

\resetv{-3\unit}\section{Hello world in Zig}

This is an example `hello world' program.

@: *
@= Imports

pub fn main() !void {
	@= Print
}
@.

We first import the standard library.

@: Imports
const std = @import("std");
@.

Then we print the desired string.

@: Print
std.debug.print("Hello world\n", .{});
@.

We can also print using a format string.

@+ Print
std.debug.print("Hello world {s}\n", .{"again"});
@.

Or we can use a \mono{writer()} method and write to stdout directly.

@+ Imports
const write = std.io.getStdOut().writer().write;
@.

@+ Print
_ = try write("Hello stdout\n");
@.

\end{document}