Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Environment env-<guid> undefined. #9

Closed
colindean opened this issue Dec 31, 2020 · 6 comments
Closed

Error: Environment env-<guid> undefined. #9

colindean opened this issue Dec 31, 2020 · 6 comments

Comments

@colindean
Copy link

I'm seeing this on a project to which I'm attempting to add pandoc-latex-admonition:

$ pandoc pandoc-latex-admonition-sample.txt -f markdown --defaults testconfig.yaml -o output.pdf
Error producing PDF.
! LaTeX Error: Environment env-fd8d3a40-b6dc-4916-a88f-6e8cf64f93f4 undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.72 ...{env-fd8d3a40-b6dc-4916-a88f-6e8cf64f93f4}

I seem able to reproduce it against the example file. It seems related to adding glossaries.

What seems like the minimal files necessary to reproduce this: https://gist.github.com/colindean/ffd9e24299582f72af8de1e385e6df60

I'm running pandoc 2.9.1 in my builds (a specific container built for this) but I seem able to reproduce it against pandoc 2.10.1 as well.

$ pandoc --version
pandoc 2.9.1
Compiled with pandoc-types 1.20, texmath 0.12, skylighting 0.8.3
Default user data directory: /root/.local/share/pandoc or /root/.pandoc
Copyright (C) 2006-2019 John MacFarlane
Web:  http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.

I'm running this using pandocker with basically

alias pandoc="docker run -it --rm -v \$(pwd):/pandoc dalibo/pandocker:stable"

Outputting latex instead of pdf shows that the environments are matched.

I'm very eager to get this working. It appears that #2 and #6 delved into this but neither author posted a solution.

@colindean
Copy link
Author

I set up pandoc and pandoc-latex-admonition from scratch

  • pandoc 2.11.3
  • pandoc-latex-admonition 1.3.1
  • texlive-latex-extra 2017.20180305-2
  • pdfTeX 3.14159265-2.6-1.40.18

@colindean
Copy link
Author

I poked around a bit and can't figure it out.

@hauptanja
Copy link

I am having the same problem.

@chdemko
Copy link
Owner

chdemko commented Jul 13, 2023

Can you post steps to reproduce the issue?

@chdemko chdemko reopened this Jul 13, 2023
@chdemko
Copy link
Owner

chdemko commented Jul 13, 2023

It seems that is issue comes from pandoc itself (jgm/pandoc#3139 and pandoc-discuss) which overrides the LaTeX header. I suggest not using the --include-in-header option and to add

header-includes:
- |
  ```{=latex}
  \usepackage{glossaries}
  \setacronymstyle{long-short-desc}
  \makenoidxglossaries
  \include{glossary}
  ```

in the metadata block of pandoc-latex-admonition-sample.txt.

@chdemko chdemko closed this as completed Jul 13, 2023
@hauptanja
Copy link

hauptanja commented Jul 13, 2023

docker run --rm --platform linux/amd64 --volume "pwd:/pandoc" --user id -u:id -g dalibo/pandocker --listings -V geometry:margin=1in --from markdown --template=default.tex -s --pdf-engine=lualatex --toc --toc-depth=2 --top-level-division=chapter --filter pandoc-latex-admonition -f markdown-implicit_figures ./manual_final.md -o ./manual_final.pdf

template.tex

\documentclass[a4, 12pt]{report}
\usepackage[margin=1in]{geometry}
\usepackage{fontspec}
\usepackage{hyperref}
% \usepackage{adjustbox}
\usepackage{float}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{tocloft}
\usepackage{titling}
\usepackage{longtable}
\usepackage{listings}
% \usepackage{tabularx}
% \usepackage{booktabs}
% \usepackage{fvextra}
\usepackage{xcolor, tcolorbox, footnote, ifthen} % for pandoc-latex-admonition

\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}%
}
\setlength{\emergencystretch}{3em} % prevent overfull lines

% $if(listings)$
\usepackage{listings}
\newcommand{\passthrough}[1]{#1}
% $endif$

$if(tables)$
\usepackage{longtable,booktabs,array}
$if(multirow)$
\usepackage{multirow}
$endif$
\usepackage{calc} % for calculating minipage widths
$endif$

\restylefloat{figure}
\setmainfont{Lato} 
% \setsansfont{Liberation Sans}
\setmonofont{Liberation Sans}

% Set up the page style for the document
\fancypagestyle{fancy}{%
  \fancyhf{} % Clear header and footer
  \renewcommand{\headrulewidth}{0pt} % Remove header rule
  \renewcommand{\footrulewidth}{0pt} % Remove footer rule
  \lhead{\hrulefill} % Add horizontal line to header
  \rhead{} % Clear right header
  \cfoot{\thepage} % Page number in the center of the footer
}

% Chapter formatting
\titleformat{\chapter}[display]
  {\normalfont\large\bfseries}{}{0pt}{\LARGE}

% Set up the table of contents formatting
\renewcommand{\cftchapdotsep}{\cftdotsep} % Use dots for chapters
\renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}} % Use dots for chapter entries
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\setcounter{tocdepth}{2}

$if(graphics)$
\usepackage{graphicx}
  % Redefine \includegraphics so that, unless explicit options are
  % given, the image width will not exceed the width or the height of the page.
  % Images get their normal width if they fit onto the page, but
  % are scaled down if they would overflow the margins.
  \makeatletter
  \def\ScaleWidthIfNeeded{%
   \ifdim\Gin@nat@width>\linewidth
      \linewidth
    \else
      \Gin@nat@width
    \fi
  }
  \def\ScaleHeightIfNeeded{%
    \ifdim\Gin@nat@height>0.9\textheight
      0.9\textheight
    \else
      \Gin@nat@width
    \fi
  }
\makeatother

\setkeys{Gin}{width=\ScaleWidthIfNeeded,height=\ScaleHeightIfNeeded,keepaspectratio}%
$endif$

\begin{document}

% Cover page
\begin{titlepage}
  \centering
  \includegraphics[width=0.5\textwidth]{biocoded-head.png} % Replace with your logo image

  \vspace{2cm}
  
  \Large\textbf{$title$}

  \Large\textbf{$revision.number$}

  \vspace{1cm}

  \textbf{$subtitle$}

  \vspace{0.5cm}

  \small\textbf{$companyname$}

  \small\textbf{$companyaddress$}

  \small\textbf{$officeaddress$}

  \vspace{0.5cm}

  \small\textbf{$contact$}

  \vspace{0.5cm}

  \small\textbf{$date$}

  % Clear the page for the next content
  \clearpage
\end{titlepage}


% Table of Contents
\tableofcontents
\clearpage

$body$

\end{document}

manual_final.md

---
title: '{}'
revision:
  number: '0'
subtitle: `Subtitle '
companyname: `...'
companyaddress: `....'
officeaddress: `....'
contact: 'Contact E-mail: ...'
date: {}

papersize: a4
toc: true
mainfont: Lato
geometry: margin=1in

pandoc-latex-admonition:
  - color: gray
    classes: [admonition]
---
Blabla...

~~~admonition
This is important content
~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants