Cambiar lstdefinestyle no parece funcionar

Cambiar lstdefinestyle no parece funcionar

Soy bastante nuevo en el uso de LaTeX y estoy intentando revisar un archivo preexistente .latexpara que los bloques de código se vean como a continuación:

I'm a code block and I'm pretty!
Important info goes here.

Una advertencia es que este es un LaTeX.plantillaque quiero usar con pandoc, por lo que se usa en paralelo con otro archivo que contiene todo el texto que se va a editar (en este caso, Markdown). Intenté hacer referencia a las plantillas de otras personas, copiar y pegar, etc., pero no pude encontrar ninguna con formato para bloques de código que funcionara para mí. Adjuntaré lo que tengo hasta ahora a continuación. El que estoy modificando es más complicado que otros que he visto; de hecho, estoy modificando el que usamos en el trabajo porque necesita una actualización y hay algunas cosas aquí que aún no entiendo del todo. En general, estoy contento con su apariencia, excepto por los bloques de código (y el resaltado en línea como this).

TLDR: ¿Cómo consigo que el formato del bloque de código aparezca realmente? Nunca ha cambiado del formato de bloque de código predeterminado. ¡Ayuda!

EDITAR: Después de hurgar un poco más, si agrego

\begin{lstlisting}
Test doc
\end{lstlisting}

en esta plantilla, Test docaparece con el formato deseado. ¿Cómo consigo que el documento de látex también formatee los bloques de código entrantes de otros archivos que usan ```?

\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$]{$documentclass$}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{longtable}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
 % provides \textsubscript
\usepackage{fixltx2e}
%\usepackage{package/garamond}
%\usepackage[T1]{fontenc}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{titlesec}
\usepackage[export]{adjustbox}
\usepackage{graphicx}
\usepackage{listings}

\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

\definecolor{SpecialBlue}{HTML}{2E93CE}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.5,0.5,0.5}

\lstdefinestyle{mystyle}{
    backgroundcolor=\color{backcolour},
    commentstyle=\color{codegreen},
    keywordstyle=\color{magenta},
    numberstyle=\tiny\color{SpecialBlue},
    stringstyle=\color{codepurple},
    basicstyle=\ttfamily\footnotesize,
    breakatwhitespace=false,
    breaklines=true,
    captionpos=b,
    keepspaces=true,
    numbers=left,
    numbersep=5pt,
    showspaces=false,
    showstringspaces=false,
    showtabs=false,
    tabsize=2
}

\lstset{style=mystyle}

\let\Oldincludegraphics\includegraphics
\renewcommand{\includegraphics}[1]{\Oldincludegraphics[max width=\linewidth]{#1}}
\titleformat{\section}
{\color{SpecialBlue}\normalfont\Large\bf}
{\color{SpecialBlue}\thesection}{1em}{}

% ~~~~~~~~~~~~~~~~~~~~ HEADER & FOOTER ~~~~~~~~~~~~~~~~~~~~
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyhead[R]{\scriptsize $title$\\$date$}
\fancyfoot[L]{{\scriptsize Proprietary and Confidential}}
\fancyfoot[C]{\raisebox{-0.5\height}{\Oldincludegraphics[width=1in]{Special_logo_2020.png}}}
\fancyfoot[R]{\scriptsize Page \thepage}

% use microtype if available
\textwidth = 6.5in
\oddsidemargin = 0in
\hoffset = 0in
\fancyheadoffset{0in}
\fancyfootoffset{0in}


$if(lhs)$
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
$endif$

\ifxetex
  \usepackage[setpagesize=false, % page size defined by xetex
              unicode=false, % unicode breaks when used with xetex
              xetex]{hyperref}
\else
  \usepackage[unicode=true]{hyperref}
\fi
%~~~~~~~~~~~~~~~~~~~~~~~~~~ LINKS ~~~~~~~~~~~~~~~~~~~~~~~~~
\hypersetup{breaklinks=true,
            bookmarks=true,
            pdfauthor={$author-meta$},
            pdftitle={$title-meta$},
            colorlinks=false,
            urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
            linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
            pdfborder={0 0 0}}
$if(links-as-notes)$
% Make links footnotes instead of hotlinks:
\renewcommand{\href}[2]{#2\footnote{\url{#1}}}
$endif$
$if(strikeout)$
\usepackage[normalem]{ulem}
% avoid problems with \sout in headers with hyperref:
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
$endif$
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
$if(numbersections)$
$else$
\setcounter{secnumdepth}{0}
$endif$
$if(verbatim-in-note)$
\VerbatimFootnotes % allows verbatim text in footnotes
$endif$
$for(header-includes)$
$header-includes$
$endfor$
$if(tables)$
\usepackage{ctable}
\usepackage{float} % provides the H option for float placement
$endif$

$if(title)$
\title{$title$}
$endif$
$if(author)$
\author{$for(author)$$author$$sep$ \and $endfor$}
$endif$
$if(date)$
\date{$date$}
$endif$


%~~~~~~~~~~~~~~~~~~~~~~~~~~~ PAGE ~~~~~~~~~~~~~~~~~~~~~~~~
\begin{document}

$if(title)$
\maketitle
$endif$

$for(include-before)$
$include-before$

$endfor$
$if(toc)$
{
\hypersetup{linkcolor=black}
\tableofcontents
}
$endif$
\thispagestyle{fancy}
$body$


$if(natbib)$
$if(biblio-files)$
$if(biblio-title)$
$if(book-class)$
\renewcommand\bibname{$biblio-title$}
$else$
\renewcommand\refname{$biblio-title$}
$endif$
$endif$
\bibliography{$biblio-files$}

$endif$
$endif$
$if(biblatex)$
\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$

$endif$
$for(include-after)$
$include-after$

$endfor$
%\ungaramond
\end{document}

Respuesta1

Debe indicar pandocel uso listingsagregando la opción --listings:

pandoc -f markdown -o out.tex --template yourtemplate in.md --listings 

información relacionada