You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ramon Rüttimann
ca87271792
|
5 years ago | |
---|---|---|
.. | ||
README.md | 5 years ago | |
delim | 5 years ago | |
go.mod | 5 years ago | |
main.go | 5 years ago |
README.md
Delim
This is a small helper utility for building the latex document.
It is called by thesis.tex with the following newcommand
:
\newcommand{\gofilerange}[4][]{%
\immediate\write18{./utils/delim -file="#2" -start="#3" -end="#4"}
\IfFileExists{code.lineno}
{\CatchFileEdef{\linenumber}{./code.lineno}{\endlinechar=-1 }}
{\def\linenumber{0}}
\edef\flags{firstnumber=\linenumber,#1}
\expandafter\gofile\expandafter[\flags]{./code.snippet}
}
Basically, delim
receives the filename and a start- and end-comment.
It then writes the files content between the two comments into code.snippet
,
and the starting line number into code.lineno
.
These are then used by the minted
package to display the code section
within the document.
Use it in the document like so:
\gofilerange{this/file.go}{start-section}{end-section}