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

Problem with LaTeX code for multi-line comments with blank lines #5398

Closed
jespercockx opened this issue May 17, 2021 · 1 comment · Fixed by #5520
Closed

Problem with LaTeX code for multi-line comments with blank lines #5398

jespercockx opened this issue May 17, 2021 · 1 comment · Fixed by #5520
Assignees
Labels
backend: latex LaTeX generation backend type: bug Issues and pull requests about actual bugs
Milestone

Comments

@jespercockx
Copy link
Member

In #2588 , @bafain reports the following:

There seems to be a problem with the LaTeX code generated for multi-line comments that contain blank lines.

Agda version: 2.6.2-292237b
XeTeX version: 3.14159265-2.6-0.999991 (TeX Live 2019/Arch Linux)
Literate Agda file Test.lagda:

\documentclass{article}
\usepackage{agda}
\begin{document}
\begin{code}
module Test where

{-
-}

{-
A
-}

{-
B
B
-}

{-
C

C
-}
\end{code}
\end{document}

Generated LaTeX file latex/Test.tex:

[..]
\>[0]\AgdaComment{\{-
C

C
-\}}\<%
[..]

Error:

$ agda --latex Test.lagda
$ cd latex
$ xelatex Test.tex 
[..]
Runaway argument?
{\textcolor {AgdaComment}{\{- C 
! Paragraph ended before \text@command was complete.
<to be read again> 
                   \par 
l.34 \end{code}

? 
@jespercockx jespercockx added type: bug Issues and pull requests about actual bugs backend: latex LaTeX generation backend labels May 17, 2021
@jespercockx jespercockx added this to the 2.6.3 milestone May 17, 2021
@andreasabel andreasabel self-assigned this Aug 18, 2021
@andreasabel andreasabel modified the milestones: 2.6.3, 2.6.2.1 Aug 18, 2021
@andreasabel
Copy link
Member

andreasabel commented Aug 18, 2021

A fix seems to be:

  • wrap each non-empty comment line into its own \AgdaComment macro,
  • output empty comment lines as such.

This is basically #2588 (comment) (@nad):

A simple fix might be to extend stringLiteral to handle comments as well.

@andreasabel andreasabel mentioned this issue Aug 18, 2021
andreasabel added a commit that referenced this issue Aug 18, 2021
Block comments are now latexed line-by-line, rather than as one
paragraph.  This solves the problem of empty lines.
andreasabel added a commit that referenced this issue Aug 19, 2021
andreasabel added a commit that referenced this issue Nov 17, 2021
Block comments are now latexed line-by-line, rather than as one
paragraph.  This solves the problem of empty lines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: latex LaTeX generation backend type: bug Issues and pull requests about actual bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants