jterrace / sphinxtr

The Sphinx Thesis Resource
http://jterrace.github.com/sphinxtr
Other
154 stars 50 forks source link

latex: code highlighting debugged #17

Closed erikbgithub closed 10 years ago

erikbgithub commented 11 years ago

I changed something that it works now, but it is also more ugly. Please build it and check before merging that everything is still as you like it. Looks are certainly a nice to have, but if we could make all the code blocks beautiful again, I also wouldn't mind. I won't go hunting for such details currently, though.

jterrace commented 11 years ago

I don't want to merge this change. I just pushed a commit that adds a code block with syntax highlighting. It looks great in HTML, but it's broken in LateX.

Honestly, I don't want to use Pygments at all for the latex output. The file we'd have to modify from sphinx is: https://bitbucket.org/birkenfeld/sphinx/src/f8a5495de3fa7fe6f8eb86a84caff93c7bc1c1c4/sphinx/directives/code.py?at=default

I'd like to instead modify the output of the code blocks to use the lstlisting package instead. It has really nice support for languages. This is all the time I have for today though - let me know if you think you can take that on, otherwise I will get to it when I have time.

erikbgithub commented 11 years ago

I just don't get the logic in this. Yes, lstlisting might be much better than Pygments. I can't say, but I can accept it, if you feel that way. But...

Reason 1: Pygments can handle both HTML and LaTeX output (beside a load of other formats), while lstlisting can only handle LaTeX. This alone makes it a clear decision in my eyes.

Reason 2: Maintaining 2 packages where you could maintain one package to do the job is just adding unnecessary work for the future.

Reason 3: With that code.py file you are showing me, you say that putting in lstlisting correctly might be a load of work. On the other hand Pygments seems to just need some adjustments to work properly and look good.

Please let this convince you, that lstlisting is very likely a bad idea.

jterrace commented 11 years ago

My main reasoning is that lstlisting is much more feature complete and is the standard practice for latex. I think it makes more sense for sphinxtr to cater to latex first, since the latex version of a thesis often has very strict formatting requirements.

erikbgithub commented 11 years ago

Sounds reasonable.