Print matrix as html/pdf table

I have a rather wide matrix containing UTF-8 strings. Here’s an example of 6 columns (there are usually more than twice that)

 "Scarabaeus lamarcki"  "First runs from nest"  "1"  "1 πŸ•’"  "0 πŸ•’"  "420 πŸ•’"
 "Coffee beetles"       "First runs from nest"  "2"  "1 πŸ•‘"  "1 πŸ•–"  "0 -"  
 "Coffee beetles"       "Sun reflection"        "1"  "2 πŸ•–"  "1 πŸ•–"  "0 -"  

I want to convert this to an HTML document (double click and view in a browser) or a PDF (both would be nice, but just one would be fine).
I tried:

  1. Directly parsing the matrix into html text following this post. But then I need to input that into some index.html file.
  2. a few external tools to convert CSV to markdown, and then use pandoc to convert the markdown to whatever. Nice, but UTF8 and table size becomes a bit of an issue.
  3. The Millboard.jl package, cool, but it’s not markdown syntax, and then I run into similar problems as in #2.

All of these options are workable. But am I missing something obvious? Is there a good way to convert a Matrix{String} to a PDF/HTML?

This worked for me:

  1. print out your matrix into a CSV file with writecsv
  2. run xelatex with the following on your generated CSV file (a.csv in this example):
\documentclass{standalone}
\usepackage{fontspec}
\usepackage{csvsimple}
\setmainfont{Symbola}
\begin{document}
\csvautotabular{a.csv}
\end{document}
1 Like