Git Product home page Git Product logo

Comments (17)

ggilmore avatar ggilmore commented on September 3, 2024 4

I needed to apply the following diff in order to get make to work:

diff --git a/main.tex b/main.tex
index a65621d..a02003b 100644
--- a/main.tex
+++ b/main.tex
@@ -1,5 +1,7 @@
 % documentclass and similar are handled by pandoc in the Makefile.

+\newcommand{\passthrough}[1]{\lstset{mathescape=false}#1\lstset{mathescape=true}}
+
 \begin{document}

 % Cover matter is handled by pandoc in the Makefile.

from ebook.

yonush avatar yonush commented on September 3, 2024 3

Hi @wizofe. I was getting the same issue under windows. I am using Pandoc 2.1.1 and MiKTeK 2.9.6520 x64 with a custom build script - essentially batch file that creates the PDF and epub

I managed to trace my problem to this file - lines 670-672

41_advanced_unit_testing.md

image

For some odd reason the emitted latex code does not parse very well and i'm not an expert in latex commands. I changed it to the following, which is probably not the best solution, but it generates the PDF without issues.
image

from ebook.

timparenti avatar timparenti commented on September 3, 2024

Hi, @wizofe. Could you post your full updated Makefile recipe for the pdf target, and not just a couple lines? On first glance, it seems like the line continuation \ at the end of your --pdf-engine line is missing.

As for the fatal: your current branch 'master' does not have any commits yet error, how are you cloning the repository?

from ebook.

wizofe avatar wizofe commented on September 3, 2024

Hi @timparenti! Thanks for your answer ⌨️My Makefile paste follows. As for the git fatal, I git forked & cloned the repo on my account.

TITLE=A Friendly Introduction\\\\to Software Testing
AUTHOR=Bill Laboon
DEDICATION=for AKS and CKN


# If pandoc or xelatex are not in your PATH, specify their locations here:
PANDOC= pandoc
XELATEX= xelatex

MD_FILES=       $(wildcard text/*.md)


pdf:    main.tex tex_files
# Uses date of most recent commit in repo
        $(PANDOC) main.tex -o software-testing-laboon-ebook.pdf \
                --pdf-engine $(XELATEX) \
                --top-level-division=chapter -N --toc --toc-depth=2 \
                -M documentclass="book" \
                -M classoption="twoside" \
                -M classoption="letterpaper" \
                -M geometry="margin=1.25in" \
                -M title="\Huge{\textbf{${TITLE}}}" \
                -M author="\LARGE{${AUTHOR}}" \
                -M date="{\Large\textcopyright~\textbf{$(shell git log -1 --date=iso --format='%ai' | cut -c-10 )}}\\\\Compiled in PDF\LaTeX{}\endgraf\textit{${DEDICATION}}"

tex_files:      compiled_tex/ $(patsubst text/%.md,compiled_tex/%.tex,$(MD_FILES))
compiled_tex/:
        mkdir -p compiled_tex/
compiled_tex/%.tex:     text/%.md
        $(PANDOC) text/$*.md \
                --listings --highlight-style kate \
                -o compiled_tex/$*.tex


clean:
        rm -rf compiled_tex/
        # Remove temporary compilation directories, if they still exist
        rm -rf tex2pdf*/

.PHONY: pdf tex_files clean

from ebook.

timparenti avatar timparenti commented on September 3, 2024

@yonush Any chance you'd be able to provide the (bad) LaTeX code that pandoc generates for those lines as they appear in this repo? It's possible it's a bug in the upstream project, which has happened here before.

from ebook.

yonush avatar yonush commented on September 3, 2024

@timparenti This appears to be the bad code generated by Pandoc that breaks. image
This is the excerpt from the input.log
image

from ebook.

timparenti avatar timparenti commented on September 3, 2024

Yep, with Pandoc 2.1.1, I get the following in compiled_tex/41_advanced_unit_testing.tex at lines 1106–1115:

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
  \passthrough{\lstinline!int j = 7;!}
\item
  \passthrough{\lstinline&System.out.println("Bark!");&}
\item
  \passthrough{\lstinline!foo--;!}
\end{enumerate}

I finally got around to looking at this more, and greping through the compiled_tex/ files, I see most \lstinlines use a ! delimiter, but those with ! in them use ". It seems & is the third choice if both ! and " are used, and the "Bark!" line here is the only place that happens in our text.

Ampersands are funny creatures in LaTeX. They generally need to be escaped when you want them to be treated as literal. It seems that something about the dummy \passthrough command Pandoc introduced recently to help with escaping is not actually expecting these ampersands.

Probably & should just be removed from the list of characters that can delimit a \lstinline in Pandoc's LaTeX writer, since it requires special treatment, which was recognized in jgm/pandoc@24acb71 just before 2.1.1 was released. Interestingly, _ should probably meet the same fate, but it's less likely to crop up as an issue since it's currently the sixteenth-choice delimiter.

I've just opened jgm/pandoc#4369 against the upstream project to do this. Thanks for reporting this behavior!

from ebook.

TiburonzinGT avatar TiburonzinGT commented on September 3, 2024

@timparenti Hello, I would like to translate to Spanish but I do not know how. I would like to do it by means of pull request :)

from ebook.

laboon avatar laboon commented on September 3, 2024

@shadowz10 I would love to see this translated into Spanish! It may make more sense to do this a separate repository, though, instead of as a PR.

from ebook.

TiburonzinGT avatar TiburonzinGT commented on September 3, 2024

@laboon I do translations for utopian.io and they require that it be with PR.
I would love to contribute with translations into Spanish by doing PR.

from ebook.

TiburonzinGT avatar TiburonzinGT commented on September 3, 2024

@laboon If you want, I could set up a repository so I can work making a
PR. thanks

from ebook.

timparenti avatar timparenti commented on September 3, 2024

@laboon @wizofe Just a note that jgm/pandoc#4369 was merged upstream on 26 April 2018 and released in pandoc 2.2 on 27 April 2018.

I just re-ran this with a fresh upgrade to pandoc 2.2.1 via Homebrew (with the updated Makefile parameters for pandoc 2.x in #144), and it now compiles cleanly, so this one can probably be closed now.

from ebook.

laboon avatar laboon commented on September 3, 2024

@wizofe if this works for you, let me know and I can close it up.

from ebook.

bubifengyun avatar bubifengyun commented on September 3, 2024

What is your latex version? I update my pandoc to 2.2.1, but still

! Undefined control sequence.
<recently read> \passthrough

it seems that latex lstlistings did not contain this command.

from ebook.

yonush avatar yonush commented on September 3, 2024

The above error still persists for me too. I am using the latest build of Pandoc 2.2.1 and recently updated MikTex.

from ebook.

bubifengyun avatar bubifengyun commented on September 3, 2024

I just download texlive 2018, still

from ebook.

bubifengyun avatar bubifengyun commented on September 3, 2024

I need renewcommand passthrough, I had solved, ref https://stackoverflow.com/questions/50854429/bookdown-undefined-control-sequence-recently-read-passthrough

from ebook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.