# How to rotate a Markdown table to landscape? Solutions I've tried print the markup instead of the rendered table

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:

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

I found following solution:

---
title: "Doc-Title"
lang: "de"
- |
{=latex}
\usepackage{pdflscape}
\newcommand{\blandscape}{\begin{landscape}}
\newcommand{\elandscape}{\end{landscape}}

...



    \blandscape

|:------|:------|------:|
|LINE1  | VAL 1 |  1.00 |
|Line2  | val 2 |  2.07 |
|Line3  | val 3 |  3.14 |

\elandscape


You can use LaTeX chunks inside Markdown, but not markdown inside LaTeX.

In the markdown to LaTeX conversion, what it is inside a command argument or an LaTeX environment is simply ignored (On the other hand, note that the Markdown table is converted to a LaTeX longtable, that could not be used in some conditions (e.g., in two columns documents).

One solution could be first export only the Markdown table and then copy & paste (or \input) the LaTeX code (of the longtable only) in the rotating environment.

Other, more convenient, is to write the nesting environment with the Markdown syntax:

---
output:
pdf_document: default
- \usepackage{lscape}
---

::::::::{.landscape data-latex=""}

11 12 13
-- -- --
21 22 23
31 32 33

::::::::


Removing irrelevant code in the LaTeX output, the above should be equivalent to:

\documentclass{article}
\usepackage{lscape,longtable,booktabs}
\begin{document}
\begin{landscape}
\begin{longtable}[]{@{}lll@{}}
\toprule
11 & 12 & 13\tabularnewline
\midrule

• They are simply the landscape environment in rmarkdown syntax. See bookdown.org/yihui/rmarkdown-cookbook/custom-blocks.html