We are currently planning to migrate to a different platform for the forum. We will announce this fact both here and on Twitter, once we have settled on a solution.

Using Markdown for definitions

edited April 13 in General

Forgive me, I can't get the forum editor to display what I can't get Pandoc to display when I add text in a certain format to Zettlr. So I'll just describe what I'm trying to do.

  • Here's a rough idea:

Hello, Ola, Shalom
Definition of Hello, &tc.

Goodbye, Adios
Definition of Goodbye, &tc.

Foo, Bar, Bas
Common terms used to designate arbitrary names.

Even better
Make the terms left-justified and line up their definitions on the same line, several spaces to the right.

  • Try to achieve this last, preferred solution, a series of 1-line definitions. Each line begins with a series of comma-separated terms (at most 4 per line). The terms at the start of a line are synonyms, so they all take the same definition. Then, to the right of the series, separated from it by what would be a few tabs on a typewriter or several spaces, the corresponding definition appears. E.g., to the left one might have a series -- "foo, bar, bas" -- and to its right, the corresponding definition, "Common terms used to designate arbitrary names." Each line would contain one such definition.

The problem with this is that I can get it to look fine in Zettlr, but Pandoc butchers it by eliminating the space separating the terms from their definitions. As a result, the rendered pdf is a mess: the terms run into the definitions, and it's virtually impossible to distinguish them.

  • Alternatively, I could live with a LaTeX description list as "moewe" describes here. I can even get this to work, in the sense that Pandoc renders it correctly.

The problem with this is that the neat, eminently readable note rendered as a pdf becomes a rats nest of LaTeX macros (including: \begin{description}, \end{description}, \item[ ], \hfill, and \\) in Zettlr. I need both the Zettlr input and the pdf output to be readily legible.

How can one achieve this so that both renderings -- the Zettlr Markdown and the rendered pdf output -- are equivalent, in the sense they're both readable?


  • edited April 16

    I've found a kludgy workaround, using Em spaces. Consider the following line in Zettlr:
            Hello, Ola, Shalom                            Definition of Greeting, &tc.
    This looks fine in Zettlr, but Pandoc changes the white space into a single space in the pdf:
            "Hello, Ola, Shalom Definition of Greeting, &tc."

    OTOH, if I use Em spaces, as Ptram advises here, using Shift-Opt-Space on my Mac, Pandoc keeps the spaces in the rendered document. So it actually resembles a list with terms on the left and definitions on the right.

    Only "resembles" because the renditions in Zettlr and the pdf are not identical. This is especially evident when the definition text is too long to fit on one line. Then in Zettlr, it might look like this:
         Goodbye, Adios                                   Definition of salutation. Here the Hebrew transliteration is omitted                                                           because it's identical to the greeting.
    But the rendered pdf looks more like this:
         Goodbye, Adios                                  Definition of salutation. Here the Hebrew transliteration is omitted                                        because it's identical to the greeting.
    This is tolerable, but not great. If I add extra spaces in front of "because" in the Markdown, then the pdf looks right but the Markdown has "because" too far to the right.

    tl;dr: The bigger problem is that for practical use one wants both the Markdown in Zettlr and the rendered text in the pdf to be properly formatted. The problem is the two renditions are not identical, even though Pandoc does respect Em spaces. So what looks right in the Markdown looks wrong in the pdf, and vice versa. At this point, I choose to have Zettlr's Markdown properly formatted and tolerate improperly formatted text in the PDF, where the white space is wrong but still appears.

    Further suggestions would be appreciated.

Sign In or Register to comment.