pleroma.debian.social

When reading code snippets in academic papers, do you like any of: monospaced font? symbol substitution (e.g. -> becomes →; \a becomes λa); syntax highlighting via colour?

@jmtd yes, only as ligatures (like e.g. JetBrains Mono has), and yes

@jmtd I'm in love with LaTeX, so being biased:

1. Monospace -- yes, please!
2. Symbols -- yes, this suggest someone is serious about typography,
3. Optional. Haven't seen this much, but maybe I'm just old.

@goldmann Thanks for your feedback! funny you should mention LaTeX, that is relevant to why I asked :-)

@laxla so you like the symbols in say, your editor (wiht ligature-font) but not in a PDF, is that right? Thanks for your response!
replies
1
announces
0
likes
0

@jmtd what I meant is, don't use the arrow unicode character, but instead, a font with ligatures; Otherwise, monospacing is useless.

@jmtd I cannot imagine writing such papers in something else than LaTeX 🙂

Two examples. Exhibit A: formatted using Listings package; Exhibit B: formatted using "lhs2tex", without any option tweaks

I think I'd prefer B if it hadn't gone so heavy with italics. I might be able to turn that off.
Exhibit A: formatted using Listings package Exhibit B: formatted using "lhs2tex", without any option tweaks

@laxla ah I see. Yeah, in the LaTeX packages I am looking at, they put a lot of effort into vertical alignment issues

@jmtd wait. LaTeX? Aren't you doing code snippets? Or do you mean math?

@laxla Code. This is a computing PhD thesis. Edit: but the preprocessor lhs2tex is using math-environments for the typesetted code, so there's some overlap here

A bit of fiddling with lhs2tex…
formatted haskell code with keywords bold and blue, syntax symbols coloured red, sans-serif fonts, and variable names italic

this is copying the syntax highlighting decisions that my code editor is using, but now I'm wondering, more fundamentally, what do I want to emphasise or de-emphasise? what is important? aargh

@jmtd always monospaced

@jmtd then why use LaTeX?

@laxla Latex is a pretty natural choice for writing a PhD thesis. What would you suggest instead?

@rivets for alignment? or legibility? I've seen convincing arguments both for and against legibility of proportional versus monospaced text. Personally I'm not sure.

@jmtd idk. I just don't think a syntax that is intended for math is what you need.

Markdown, compiled to a PDF (or whatever other format you use), perhaps?

@laxla Thanks for your input. Most Markdown→PDF workflows round-trip via LaTeX (I'm pretty sure Pandoc does). And I'm not sure they do anything special wrt formatting code -- likely just monospace it. Alas it's too late in my write-up to rework the whole thing in Markdown (or anything else) now. FWIW I've been mostly happy with LaTeX.

@jmtd I did find something for you, though.

@laxla thanks: I hadn't seen or tried "minted" from those answers, so I'll give it a look!

@jmtd monospacing helps with chunking so makes skimming the code much more effective.