JacquesCarette / Drasil

Generate all the things (focusing on research software)
https://jacquescarette.github.io/Drasil
BSD 2-Clause "Simplified" License
142 stars 26 forks source link

Investigate Inconsistent Table (Cursor) Highlighting in LaTeX Backend #663

Open Mornix opened 6 years ago

Mornix commented 6 years ago

Continuation of #51 from CaseStudies but brings the investigation to the generated docs as they exhibit the issues as well, and aren't implemented in the same way as the manual versions.

peter-michalski commented 4 years ago

I am looking at this issue now and I could not reproduce the problem after running (compiling the PDF) the GamePhysics_SRS.tex Drasil generated document. Once compiled, if I highlight a row of a table in the PDF only the desired row was highlighted. As I understood the issue, highlighted rows / text would cause additional text from the column to be highlighted. Please confirm.

Caveat: In order to compile the PDF with my compiler I had to insert "% !TeX program = lualatex" at the top of the document. Without this line I got an error: "Fatal fontspec error: "cannot-use-pdftex" The fontspec package requires either XeTeX or LuaTeX. You must change your typesetting engine to, e.g., "xelatex" or "lualatex"instead of "latex" or "pdflatex". For immediate help type H ." I don't think this is related, but I did need to add this line into the generated document.

smiths commented 4 years ago

@peter-michalski, I have looked into this a little bit. The Makefile that is generated for Drasil uses lualatex. I was able to compile the generated tex file (for game physics) in the stable folder. (I have lualatex installed on my machine.) When I open the file with Preview (on my Mac) and select text within the tables the odd behaviour originally observed by @Mornix is reproduced. Interestingly, when I open the pdf file with google chrome, the rows are selected the way you would expect. That is, with the google chrome pdf viewer, the problem is not present.

I'm not sure why, but we have decided with Drasil to use lualatex for our generated files. You should use lualatex, rather than using pdflatex.

As far as the problem with selecting text in tables, I'm prepared to say that this is a product of the lualatex compiler. I don't think this is caused by our generated LaTeX code. @JacquesCarette, how much effort do you think we should spend on this inconsistency with some pdf viewers and selecting text in tables? I'd be fine if we didn't solve this issue.

JacquesCarette commented 4 years ago

We decided to use lualatex because it deals with unicode best of all of them.

@smiths I really have no idea what is involved regarding selectability, so I can't really estimate the effort needed to fix it. It doesn't feel like a high-priority issue.

smiths commented 4 years ago

@JacquesCarette, thanks for the info. I knew there was a reason for lualatex, I just didn't remember what the reason was. :-) I'm going to mark this issue as low priority.

balacij commented 3 months ago

I think that copy-pasting and general highlighting from PDFs is pretty broken in general, at least in my experience. If tables are important to keep exportable, perhaps we can go with a .csv-based approach to building them instead of directly rendering table contents inside the TeX? \usepackage{csvsimple} would be helpful for this. Alternatively, we can try to use another library for building better scientific tables (\usepackage{pgfplotstable}).

JacquesCarette commented 3 months ago

I agree that selectability from PDF output is not really important. If some data displayed in tables should also be available, I think a .csv would be a good idea. (We should look at embedded meta-data in the PDF - is that what csvsimple allows?)

And yes, upgrading our tooling (such as pgfplotstable) instead of doing things in a rather 'raw' form is also a good idea.

I'd say we should spin off some actionable issues from this one, and then close it.