# Print matrix as html/pdf table

**URL:** https://discourse.julialang.org/t/print-matrix-as-html-pdf-table/4924
**Category:** General Usage
**Tags:** question
**Created:** [July 18, 2017, 12:15pm UTC](https://discourse.julialang.org/t/print-matrix-as-html-pdf-table/4924 "2017-07-18T12:15:18Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)
#### Post date: [July 18, 2017, 12:15pm UTC](https://discourse.julialang.org/t/print-matrix-as-html-pdf-table/4924/1 "2017-07-18T12:15:18Z")

</div>

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

```julia
 "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](https://discourse.julialang.org/t/best-tool-for-printing-tables-in-jupyter-notebook/3548/8). But then I need to input that into some `index.html` file.
2. a few [external tools](https://github.com/ickc/pantable) 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`](https://github.com/wookay/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?

---

<div class="post-metadata">

### Author: ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)
#### Post date: [July 18, 2017, 1:44pm UTC](https://discourse.julialang.org/t/print-matrix-as-html-pdf-table/4924/2 "2017-07-18T13:44:15Z")

</div>

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):

```nohighlight
\documentclass{standalone}
\usepackage{fontspec}
\usepackage{csvsimple}
\setmainfont{Symbola}
\begin{document}
\csvautotabular{a.csv}
\end{document}

```
