Zettelkasten Forum


Help with Printing/Exporting Zettels from the Archive

**TLDR: I want to create a macro to print a stack of Zettels from the Archive onto A6/4x6 cards. **

I've hunted around the forum here a few times, but wondering anyone can start pointing me toward the right direction.

The User Experience

I love The Archive and Zettelkasten method. But sometimes I just want to print off a pile of my cards when I'm going to do a writing project. There's just no equivalent to the tactile experience of having 10-20 cards on a desk, shuffling them around, pinning them to a board, etc.

Of course, this is possible in an analog Zettelkasten. But I like having my digital Zettelkasten 90% of the time. I just want to occasionally recreate the paper version from time to time. Or even to have a completely paper backup. I'm not a Luddite! But paper is nice.

The Idea

I'm looking for an easy way to bring these two together. I'd like to be able to simply convert a Zettel from the archive into an A6 (4X6 index card PDF) with a basic format: Title in the upper left, Zettel ID in the upper right, body and references in the center, and tags either at the bottom or under the title.

Even better if after running a search in The Archive, I could highlight 10 or 12 Zettels, and run a macro on Keyboard Maestro to compile that stack in a single PDF that I can then print. It seems like this could be easily doable through Pandoc or LaTeX, but the learning curve for formatting an A6 card is very steep. And I don't know how to extract the Zettel anatomy: Title, ID, Tags. And after repeated attempts, I have not successfully been able to make a keyboard maestro that can automatically run Pandoc.

Can Anyone Help Me?

This probably just exposes that I'm really way in over my head with automation and coding, and that I'm really not at all a programmer. But I'm hoping that someone here would find this laughably simple. It seems very straightforward in theory.

Has anyone else attempted anything like this? Is there anyone here who might be able to help me track this down? I'd gladly share the finished product here in case there's anyone else here (like me) who want to, from time to time, take a portion of their Archive completely offline.

Comments

  • @rydash88 I think I could use this same capability as well. I don't know how to do it, though...so I'll wait (patiently) hoping someone else does :smile:

  • @rydash88 you’re not alone; I’ve been looking for a way to print zettels as well. A specific format for printing, and ability to print 4-up per page would be fantastic.

  • Printing comes to The Archive!

    Printing a digital zettelkasten note from The Archive turns out trivial pretty damn complicated. There is a relatively high geek factor in this. Formating each note, so it looks pleasing to each note author is much harder.

    If you have any tips on how to improve this process, please let me know. Comments, criticisms, and your questions are welcome.

    Here's my attempt. It seemed easier when I created the macro. It sure isn't very easy to describe the setup. I hope I haven't missed anything. There are many steps to describe, and why it seemed initially easy for me because I had all these things already installed and working on my system for other projects, you might already have these apps installed, which will make it easy to print cards.

    Setup

    1. Homebrew
      brew install pandoc
    2. Install Latex - BasicTeX as a minimum (MacTeX if you want the package)
      https://sourabhbajaj.com/mac-setup/LaTeX/README.html
    3. Set ENV_PATH variable in Keyboard Maestro
      /usr/local/:/usr/local/sbin:/usr/local/opt/pandoc/bin/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin
    4. Set variables in Keyboard Maestro Macro

    Keyboard Maestro Macro
    Printing

    There are three commands in the Execute Shell Script.
    1. cd
    2. pandoc
    3. lpr

    You could get away with just executing the pandoc command and then printing the resulting PDF. You'd still want to install pandoc and Latex.
    pandoc --pdf-engine=xelatex -V geometry=a6paper -V geometry=landscape -V geometry:margin=.9cm /path-to-file.md -o /destination-path/target.pdf

    Will Simpson
    I'm a futzing, second-guessing, backtracking, compulsive oversharing, ZK-maniac, in other words, your typical zettelnant.
    Research areas: Attention Horizon, Productive Procrastination, Dzogchen, Non-fiction Creative Writing, Cognitive Workload, Python, Data Science
    kestrelcreek.com

  • 😆 You continue to surprise with your KM tricks! What a neat idea!

    I didn't know you could tell the printer to print directly via the command line.

    My OCD forbids me to print without checking, so I would adjust the macro to open the PDF in Preview.app and print from there to avoid ugly notes :) But I really dig the format of the print-outs. LaTeX's defaults have an artisanal quality already, and the landscape format looks like a straight-up invitation to


    For a truly temp output path, you might want to look into the mktemp program. With the -d flag, it creates a directory, and with the -t PREFIX setting, you can customize the file name:

    $ mktemp -d
    /var/folders/62/8k21681d08z9lhq8h433z3rh0000gp/T/tmp.5XuikGGC
    
    $ mktemp -t printzettel
    /var/folders/62/8k21681d08z9lhq8h433z3rh0000gp/T/printzettel.SxsMDkHI
    

    Pandoc apparently takes care of the .aux and .log files during conversion on its own, so a directory might be overkill and dropping the -d flag could work as well; here's how I tried to put the output.pdf in a temporary folder:

    cd $KMVAR_zettelkastenPath 
    destination=`mktemp -d -t printzettel`
    pandoc --pdf-engine=xelatex -V geometry=a6paper -V geometry=landscape -V geometry:margin=.9cm "$KMVAR_noteName.md" -o "$destination/output.pdf"
    open "$destination/output.pdf"
    

    Author at Zettelkasten.de • https://christiantietze.de/

  • @ctietze said:
    My OCD forbids me to print without checking, so I would adjust the macro to open the PDF in Preview.app and print from there to avoid ugly notes :)

    I know what you mean. I have a pile of 'ugly notes' from my trials. I used my pseudo temp location as a way to look and preview the format. ~/Downloads/ is my dumping grounds anyways and is periodically flushed.

    Thanks for the mktemp tip. It will make the macro more elegant.

    cd $KMVAR_zettelkastenPath 
    destination=`mktemp -d -t printzettel`
    pandoc --pdf-engine=xelatex -V geometry=a6paper -V geometry=landscape -V geometry:margin=.9cm "$KMVAR_noteName.md" -o "$destination/output.pdf"
    open "$destination/output.pdf"
    

    As I posted the comment, I discovered another way to print that is far less technical but far less configurable. You can print from your "Open with External Editor". Print from, say, Marked2 or IA Writer; you'd be restricted to their formatting options and your printer's capabilities.

    Printing sure is a mess.

    Will Simpson
    I'm a futzing, second-guessing, backtracking, compulsive oversharing, ZK-maniac, in other words, your typical zettelnant.
    Research areas: Attention Horizon, Productive Procrastination, Dzogchen, Non-fiction Creative Writing, Cognitive Workload, Python, Data Science
    kestrelcreek.com

  • @Will

    Why not just open the note in iA Writer or some other app that handles Markdown (like Scrivener) and go from there? Is it necessary to print from within The Archive?

  • It is not necessary to print at all, let alone from within The Archive.

    Until now, we've not been able to print from within The Archive, and it has not been a hindrance. Printing used to involve every time you wanted to print; you'd have to open a "note in iA Writer or some other app that handles Markdown (like Scrivener) and go from there." Now you don't have to do this; you can print right from within The Archive.

    Will Simpson
    I'm a futzing, second-guessing, backtracking, compulsive oversharing, ZK-maniac, in other words, your typical zettelnant.
    Research areas: Attention Horizon, Productive Procrastination, Dzogchen, Non-fiction Creative Writing, Cognitive Workload, Python, Data Science
    kestrelcreek.com

  • Now that you bring up printing via "External Editors" -- one could whip up an .app bundle based on the pandoc and printing steps you figured out with Automator. The resulting .app can then be added to external editors to print from there.

    All that being said, I'll be adding a more sensible printing option to The Archive based on the upcoming MultiMarkdown editor update, too. The default was just bonkers, so I disabled that early on, and now we're 3 years in, phew ...

    Author at Zettelkasten.de • https://christiantietze.de/

  • edited July 10

    I have only found this nice thread after doing some experiments of my own! To register a different approach: I selected notes (about 230) from a particular research project I wanted to review. I used B5-sized 90g/m² Pólen (yellowish) paper and an adapted LaTeX Tufte class as template. The combination yields a compact yet very legible design.

    A disadvantage of the portrait layout for the notes, though: it won't work nicely for storing them in a box. Instead, I'm using 41mm binder clips and combining the notes in "notebooks" of about one hundred sheets. The margin is sufficient for flipping the pages without hiding any content.

    Pre-processing before pandoc and LaTeX is somewhat complex. I use metadata fields in my notes (such as citekey and loc) to handle bibliographic references. A Python script transforms this information into appropriate LaTeX commands (\fullcite etc.) and does some other magic (such as detecting Wiki-links and changing them into \zettelref commands for better formatting of the cross-references). This is all too idiosyncratic for general use, but programmers may find some inspiration in the code (on GitHub).

    Post edited by brunoc on
  • @brunoc, super nice! What we can see of the output, I’m impressed. Your knowledge and use of latex and pandoc are advanced. Thanks for sharing.

    Will Simpson
    I'm a futzing, second-guessing, backtracking, compulsive oversharing, ZK-maniac, in other words, your typical zettelnant.
    Research areas: Attention Horizon, Productive Procrastination, Dzogchen, Non-fiction Creative Writing, Cognitive Workload, Python, Data Science
    kestrelcreek.com

  • edited July 10

    @Will thank you! LaTeX is a monster worth mastering, but it takes time (that is, years). I think The LaTeX Companion is still a good reference to start (should get it in the printed version).

    If you don't know it already, the work of Edward Tufte is quite interesting – in particular his arguments against PowerPoint.

  • edited July 11

    @brunoc Since you're using LaTeX in the end anyway, wouldn't it be a bit easier to skip the full bibliographic information in each note (IIRC you need to specify everything in YAML frontmatter, so you'd have to scroll down quite a bit to get to the note?) and instead use a BibTeX .bib file as the source of truth to resolve citations?

    I've been using pandoc to convert -f markdown_mmd, i.e. MultiMarkdown, to LaTeX and then import the BibLaTeX package referencing my .bib file. At least for the book projects we've been rendering here, @sfast could limit himself to inserting the [#citekey][page 123] references and not also have to copy the whole definition over.

    Your PDFs look very tasty either way :)

    Author at Zettelkasten.de • https://christiantietze.de/

  • edited July 11

    @ctietze Indeed I'm using BibTeX keys! The YAML header for the above note is this:

    ---
    title: 'Frede (1986) The Stoic doctrine of the affections of the soul'  
    id:     Φ1624  
    citekey:    Frede1986  
    loc:        0  
    tags:   #ƒ
    ...
    

    The Python script will generate a \marginnote{\fullcite{Frede1986}} from it.

    For the Author/Year/Title text I put in the title I have an Alfred workflow based on BibDeskQuery, but altered to produce its output from a BibDesk template:

    tell document 1 of application "BibDesk"
        set bibkey to q
        set thePub to get first publications whose cite key is bibkey
        set theResult to (templated text using "fichamentoTemplate" for thePub)
    end tell
    

    Frequently (although not in the above case), notes named after Author/Year/Title, with loc=0, are structured notes having links to the actual annotations, which spread over descendant notes organized by topic. (KM macros will carry the citekey by default when creating descendant notes).

    It seems the Tufte design works really nice for the job! I'm enjoying going through my notes in preparation for writing. In reflexive notes, the right margin will be populated with references, which is quite useful when you're scanning the text.

    By the way, is [#citekey][page 123] an accepted pandoc cite format? I'm used to [@citekey, 123].

  • edited July 11

    @ctietze said:
    IIRC you need to specify everything in YAML frontmatter, so you'd have to scroll down quite a bit to get to the note?) and instead use a BibTeX .bib file as the source of truth to resolve citations?

    For the backlog: even though I don't have that much information in the YAML frontmatter, I don't particularly love to look at them. The ability to hide the YAML block – or otherwise compress it using a different font/style configuration – would be appreciated! I think Typora folds it into a graphical element resembling an ellipsis (…).

  • @brunoc said:

    If you don't know it already, the work of Edward Tufte is quite interesting – in particular his arguments against PowerPoint.

    I read through the full article on "PowerPoint Does Rocket Science--and Better Techniques for Technical Reports" by Edward Tufte. It took a while to get through, but it was fascinating and very informative. Thanks for referencing it. It fits with a lot of my experience and has me thinking about whether or not I want to rely on Powerpoint presentations so much, in various engineering review boards on which I sit. Often I find myself asking for full reports on various topics, so that I can actually understand the engineering that was done. Imagine my horror when sometimes I find out there is no report; only a Powerpoint presentation!

Sign In or Register to comment.