Skip to content

[feature request] LaTeX export #394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ntguardian opened this issue Apr 7, 2020 · 16 comments
Closed

[feature request] LaTeX export #394

ntguardian opened this issue Apr 7, 2020 · 16 comments

Comments

@ntguardian
Copy link

Hello,

The original sc supported exporting LaTeX tables, and I would like that functionality to be restored in sc-im.

@mipmip
Copy link
Contributor

mipmip commented Apr 8, 2020

Can you give an example how with a sc-file and the export result how you think it should look like?

@ntguardian
Copy link
Author

If you make a spreadsheet using sc then use its TeX export feature, that's all I really want. I think in sc you set tblstyle=tex and then export using T that should be all you need to do. But you can just make a simple sc sheet and see what its LaTeX export does.

@mipmip
Copy link
Contributor

mipmip commented May 8, 2020

I don't have the old sc working. I'm a tex-dummy and always get confused by it's extensions of dialects. Please paste a piece of TeX table definition.

Things I would think of:

  • do you need table headings?
  • do you need cell or column alignment?

@ntguardian
Copy link
Author

ntguardian commented May 8, 2020

TestTable.zip
I'm uploading the zip file with a sc file and a LaTeX conversion as produced by the old sc. Note that all the tex file is not a proper LaTeX document; it only contains a table, not the rest needed to produce a document. (If you want code that turns the table into a proper TeX for, say, debugging purposes, I can do that.)

Regarding the syntax, all tables start with \begin{tabular}{.........} and end with \end{tabular}. {......} defines how many columns there are and their alignment; the provided table has {cccc} for four centered columns, while {rcl} would be a right-justified, centered, and left-justified column, respectively. Generally LaTeX does not recognize a table "header" per se; it is just another row, though a user may make that row look nicer to get something resembling a header, such as making font bold and adding a horizontal rule via \hline.

A table row has fields separated by &, and the number of & must be one less than the number of columns of the table. Notice the sc file has three effective columns while the resulting TeX table has four; I don't know why the converter made this decision, as the result is an empty column. You can view & as being equivalent to , in CSV files. Every row except the last must be concluded by \\; I'm not sure if it's incorrect for the last row to be terminated with \\, though.

As for empty rows, the sc converter handles them via a LaTeX row consisting only of & and \\.

There are of course other bells and whistles that can be added to a LaTeX table, but this is probably the bare minimum to make a useful table converter.

@andmarti1424
Copy link
Owner

If old sc did it.. We should get it back.

@andmarti1424
Copy link
Owner

I am working on this.

andmarti1424 added a commit that referenced this issue Mar 26, 2021
@andmarti1424
Copy link
Owner

@ntguardian @mipmip, please update to latest commit and try with
:e tex file.tex
thanks.

@ntguardian
Copy link
Author

ntguardian commented Mar 26, 2021 via email

@andmarti1424
Copy link
Owner

sc-im-git perhaps..
the plain sc-im package is still the v0.8 release.

@andmarti1424
Copy link
Owner

@ntguardian could you take a look at it?

@poetaman
Copy link
Contributor

poetaman commented Mar 28, 2021

In my testing its decent start, there is no custom alignment though (everything number and label cell is center aligned). Perhaps an elaborate converter could be written by user when something like this is available: #494.

generated pdf:
Screen Shot 2021-03-28 at 12 09 00 PM

for sc-im table:
Screen Shot 2021-03-28 at 12 10 14 PM

@andmarti1424
Copy link
Owner

Haven't noticed that.
The routine is an adaptation of sc's one. It seems sc doesn't have alignment either then.

@andmarti1424
Copy link
Owner

Thanks for testing it

@andmarti1424
Copy link
Owner

I think we can close this. Thanks

@ntguardian
Copy link
Author

ntguardian commented Mar 29, 2021 via email

@andmarti1424
Copy link
Owner

@ntguardian Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants