Originally, I installed Zettlr to use it as a personal knowledge management system – writing my daily notes, keeping track of tasks and having one place for all my information about customers, products, systems, standards and such. When I discovered how powerful Zettlr is in combination with Pandoc and LaTeX, I integrated it into my workflow of writing my measurement reports as well.
I use Python to analyse the data I measured. My Python code also generates the graphs and tables of the results and moves them into a specific folder. I have to include all of it in the appendix and it’s rather boring to manually generate image captions, so I let Python do that – it „knows“ what they’re about anyway! For example, I have something like this:
report = ' \n'.join([
f'# Measurement of {system} {serial number} on {date}',
'## Results',
f'{results.loc[:, ['x', 'y', 'z']].to_markdown()}',
r'\clearpage',
])
for x in y
report = report + f'\n \n'
for x in z
report = report + f'\n \n'
with open(f'report for {system} {model} {serial number} {date}.md, mode='w', encoding='utf-8') as report_file:
report_file.write(report)
This generates a Markdown file with all the graphs with captions and also a table with my data.
Of course, I still have to write my actual report and findings. Now I can use Zettlr to edit this pre-generated Markdown file and write my assessment of the measurement.
With the Markdown file done, I use Zettlr to export my report as a PDF. I don’t even need to define frontmatter for this since it’s the same for every report. So I set up a custom export profile in Zettlr:
- I write my Markdown files with the h1-headline as title, so I use
shift-heading-level-by: -1
to give the first headline as the title variable to LaTeX and shift all other headings one level up
- I’d like to have a title page, so I define
titlepage: true
under variables
- There are some logos and headers I need to include. Under variables, I define
titlepage-logo: „logo_titlepage.png“
, header-right: "\includegraphics[width=100pt]{logo_header.png}"
(the template also allows text as header-right, so I need to include a LaTeX command here)
- I don’t want a written Table of Contents – the PDF TOC is just fine.
toc: false
- My reports are in German, so I want the captions etc. to be localised. Under variables, I set
lang: de-DE
.
- The report is mostly read on 16:9 screens and includes a lot of graphs which are in landscape as well. So I set
geometry: landscape
under variables
- I have a LaTeX template, so I put in
template: measurement-report
Now I just need to Export the file via Zettlr, choose my template and can send a finished report while keeping the Markdown file in my Zettlr folder so I can include it in my future work.
Let me know if that was helpful to you or if you have tips to improve this!