[Tex/LaTex] How to rotate a Markdown table to landscape? Solutions I’ve tried print the markup instead of the rendered table

landscapepandocpdfxetex

I'm using Markdown to create a PDF via xelatex and pandoc. Here's my command line:

pandoc -s combined.markdown --from markdown+table_captions+auto_identifiers --filter mermaid-filter.cmd --pdf-engine=xelatex -o combined.pdf

My document contains the following table:

Table: Groups and Access Rights - Global

| Group Name                  | Type      | Config / Func   | Default Act | Reqs     | Derog    | ADC      | Haz      | Chg      | BS         | Risks    | MMSP Status |
| :-------------------------- | --------- | --------------- | ----------- | -------- | -------- | -------- | -------- | -------- | ---------- | -------- | ----------- |
| CPxxx Risk Managers         | \gls{ps}  | X               | CPxxx Home  |          |          |          |          |          |            |          |             |
(etc)

It's very wide, so I want to render it in landscape.
I've tried using {rotating}, {lscape}, and {pdflscape}, but they all look like this:
enter image description here

Is there any way to make this work? Is it something to do with the order of packages?

Best Answer

I found following solution:

---
title: "Doc-Title"
lang: "de"
colorlinks: true
header-includes:
- |
  ```{=latex}
  \usepackage{pdflscape}
  \newcommand{\blandscape}{\begin{landscape}}
  \newcommand{\elandscape}{\end{landscape}}
    ```
...

in your markdown use:

    \blandscape
    
    |header1|header2|header3|
    |:------|:------|------:|
    |LINE1  | VAL 1 |  1.00 |
    |Line2  | val 2 |  2.07 |
    |Line3  | val 3 |  3.14 |
    
    \elandscape