kosmikus / lhs2tex

Preprocessor for typesetting Haskell sources with LaTeX
Other
99 stars 28 forks source link

lhs2tex uses OT1 encoding? #43

Open Blaisorblade opened 8 years ago

Blaisorblade commented 8 years ago

I'm not sure I can show an actual issue, but I was concerned when I saw this code using the OT1 encoding—I'm using T1 myself for my English papers for the usual reasons—here they are, on TeX.StackExchange. EDIT: that code does appear in my output, with lhs2TeX without special options.

Could lhs2TeX just switch to the T1 encoding? Or does this question make no sense because OT1 is fine for that usage and coexists well with \usepackage[T1]{fontenc}? (In my paper I can't tell anything's wrong, but I'm not using typewriter style and the output never calls the \tex command).

kosmikus commented 8 years ago

I think these definitions are only used (in the sense of actually having an effect) in tt mode, which personally I rarely use. I've certainly have been generating T1-encoded TeX documents with lhs2tex for many years now.

In general, my policy has been to be extremely reluctant improving even bad defaults over the years, because I like to have lhs2TeX still work on even old papers that you wrote using it many years ago.

All this being said, I'm very happy to consider actual patches improving the situation, and I can even be convinced to switch the default behaviour if:

If all you're worried about is strange definitions polluting the TeX environment in poly mode, then yes, we can look at whether it's harmless to just comment them out for poly, which I think it is.

Blaisorblade commented 8 years ago

I've certainly have been generating T1-encoded TeX documents with lhs2tex for many years now.

👍 But does that work also with tt (not that I use it)? Do all font families in a document need to use the same encoding?

If so, I guess a T1 option could define those families in the T1 encoding and they'd just get more characters. But while I'm clearly no TeX expert, I looked up details and learned that both T1 variants of Computer Modern isn't even pagebreak-compatible with the original OT1 version; typography experts have further complaints (see http://tex.stackexchange.com/a/1396/1340 — not that I'd have ever noticed). If your policy is remotely related to Knuth's policy, that clearly prevents changing defaults in general.

If all you're worried about is strange definitions polluting the TeX environment in poly mode, then yes, we can look at whether it's harmless to just comment them out for poly, which I think it is.

You saying that those are safe (or maybe even a comment?) might be enough. Dropping the definitions could be cool, but you tried and gave up in 2003, I guess because the \tex command is exposed to the user in all modes and some actually used it? See https://github.com/kosmikus/lhs2tex/blob/4c85fc00c399e6f80526832aff32433452d1511c/lhs2TeX.sty.lit#L59-L61

kosmikus commented 8 years ago

Yes, there are subtle differences between all these fonts, and I think that's still the case.

My compatibility procedure is a rule of thumb, and not 100% without exception, because I think that with LaTeX, it is in general going to be rather difficult to have completely reproducible builds anyway, except if you go to great lengths to make snapshots of all included files and fonts for your documents. But in general, I appreciate it if I can re-run LaTeX and lhs2TeX on my 10-year old papers and have a good chance they still look the same.

Interesting you saw my 2003 comment, I certainly wouldn't have remembered that I already tried removing this all these years ago. I'd have to try again to see exactly what went wrong. The idea of cleaning up the whole lhs2TeX.sty and .fmt files significantly is still appealing (but so is rewriting lhs2TeX completely).

Blaisorblade commented 8 years ago

I think that with LaTeX, it is in general going to be rather difficult to have completely reproducible builds anyway

I take your word for it; but I read that for plain TeX, Knuth has a stricter version of your policy for the same reason. fixltx2e used to exist to achieve the same with LaTeX: you needed to explicitly request compatibility-breaking fixes. (Not sure how https://www.ctan.org/pkg/latexrelease behaves).

Interesting you saw my 2003 comment, I certainly wouldn't have remembered that I already tried removing this all these years ago. I'd have to try again to see exactly what went wrong.

IIUC from your comment, a document can use \tex outside tt, and it would break with your change.