LaTeX How Can I Convert a Simple CSV File to a Single Page PDF?

  • Thread starter Thread starter zunf
  • Start date Start date
  • Tags Tags
    Csv Pdf
AI Thread Summary
To convert a simple CSV file to a single-page PDF, users seek clean, minimal layouts without headers or separators, focusing on efficient use of space. Excel is suggested as a starting point for formatting, allowing for easy manipulation before exporting to PDF. Various software options, including LibreOffice and Texstudio, are mentioned for creating PDFs, with an emphasis on controlling margins and font sizes. Users express frustration over the lack of automated solutions that can adapt to different CSV sizes while maintaining a single-page format. Python and Perl scripts are also recommended for those comfortable with coding, alongside online tools for table generation.
zunf
Messages
8
Reaction score
2
Hi,
I have a really simple CSV with some data that needs to be visualized all together in a single page .

The CSV content is basically 4 columns wide with short names and small numbers in the cells so I need to create a layout where the list goes from the up left corner of the page to the bottom right one .

I don't need separators, I don't need to print lines or headers, I want a clean and minimal solution . I Just need to print the content of the CSV: the data itself .

I would like to take control over the margins of the page and the font size to not waste any space on the paper, if there is a software will automatically adjust everything based on how many entries there will be in the CSV it will be even better .

I tried csv2latex and the result is very comparable to the results that I have obtained with the csvsimple package for latex, which means that it doesn't respond to my needs and I can't achieve what I want .

Since this CSV > PDF conversion will happen once in a while I'm open to all kinds of solutions, even ones that requires softwares with a GUI.

Thanks .
 
Physics news on Phys.org
zunf said:
Hi,
I have a really simple CSV with some data that needs to be visualized all together in a single page .

The CSV content is basically 4 columns wide with short names and small numbers in the cells so I need to create a layout where the list goes from the up left corner of the page to the bottom right one .

I don't need separators, I don't need to print lines or headers, I want a clean and minimal solution . I Just need to print the content of the CSV: the data itself .

I would like to take control over the margins of the page and the font size to not waste any space on the paper, if there is a software will automatically adjust everything based on how many entries there will be in the CSV it will be even better .

I tried csv2latex and the result is very comparable to the results that I have obtained with the csvsimple package for latex, which means that it doesn't respond to my needs and I can't achieve what I want .

Since this CSV > PDF conversion will happen once in a while I'm open to all kinds of solutions, even ones that requires softwares with a GUI.

Thanks .
I often loaded csv files into excel and went on from there. This gave me additional formats: from screenshot to word. This way you could first create a doc file by copy and paste and then a pdf out of it.
 
I have at least 4 softwares to do just that, including LibreOffice since I'm on Linux, the real problem is to reflow everything on a single page and make it a single-page pdf file .

I can even create a Postscript document or a DVI file with the data on it, but since I don't have this kind of know-how with Latex or more evolved solutions I don't know how to solve this .
 
Difficult to tell from far. OO should do the same, it was just shorter to type excel and word and simultaneously transport the meaning. But once you have it as spreadsheet, can't you simply manipulate it there until it fits at least the size.

Another approach is to use global search and replace commands, preferably on a copy of the csv (I like textpad for those purposes), and transform it into a tex version. Here are examples of matrices and tables: https://www.physicsforums.com/help/latexhelp/

I downloaded texstudio to create tex files. They automatically produce a pdf and you have full control about sizes, lists or tables and fonts.
 
I'm still looking for the right solution or any solution whatsoever .

The point is having something that auto-fits itself and gives me the freedom to tune just the right amount of margins and fonts .

I'm still amazed by the fact that there is no tex package that auto-manages tabular data in a simple multi-column style A4 paper .

I didn't had much time to try new things lately but I found some plugins/scripts for scribus, maybe this will do the trick.
 
a,b,c,d,e;
1,2,3,4,5;
,,,,;

(textpad) ---> F8 ("," ---> "&") F8 (";" ---> "\\ \hline")

a&b&c&d&e\\ \hline
1&2&3&4&5\\ \hline
&&&&\\ \hline

Ctrl+A Ctrl+C

(texstudio)

\begin{tabular}{columns} <--- specs
Ctrl+V
\end{tabular}
--->
\begin{tabular}{c|c|c|c|c}
a&b&c&d&e\\ \hline
1&2&3&4&5\\ \hline
&&&&\\ \hline
\end{tabular}

upload_2018-8-18_16-50-27.png


F5 ---> .pdf
 

Attachments

  • upload_2018-8-18_16-50-27.png
    upload_2018-8-18_16-50-27.png
    763 bytes · Views: 611
You might be able to use the ideas from these python scripts
https://stackoverflow.com/questions/48863462/writing-full-csv-table-to-pdf-in-python
https://stackoverflow.com/questions/48795854/writing-csv-table-to-pdf-report
or perl
https://stackoverflow.com/questions/43641594/how-to-convert-csv-data-to-pdf-table-using-pdftable

By counting the height and width of your tabled csv file in units of characters,
you can probably come up with a formula for the optimal font size and column spacing for your paper size.
 

Similar threads

Replies
4
Views
3K
Replies
3
Views
2K
Replies
7
Views
19K
Replies
3
Views
2K
Replies
2
Views
3K
Replies
4
Views
4K
Back
Top