Method: (GENERATE T LATEX-GENERATOR)

Source

(defmethod generate (book (generator latex-generator))
  (with-output-to-file (*latex-stream* (output-file generator)
                                       :if-exists :supersede
                                       :if-does-not-exist :create)
    (declare (special *latex-stream*))
    (flet ((wl (s &rest args)
             (write-line (apply #'format nil s args) *latex-stream*)))
      (wl "\\documentclass[11pt,pdflatex,makeidx]{scrbook}")
      (wl "\\usepackage[margin=0.5in]{geometry}")
      (wl "\\usepackage{xcolor}")
      (wl "\\usepackage{makeidx}")
      (wl "\\usepackage{hyperref}")
      (when (highlight-syntax generator)
        (wl "\\usepackage{minted}")
        (wl "\\usepackage{mdframed}"))

      (when (listings generator)
        (latex-command "usepackage" "listings")
        (latex-command "lstset" "language=lisp"))

      (when (stringp (listings generator))
        (latex-command "lstset" (listings generator)))

      (wl "\\usepackage{courier}")

      (wl "\\definecolor{CodeBackground}{HTML}{E9E9E9}")
      (wl "\\hypersetup{colorlinks=true,linkcolor=blue}")

      (wl "\\parindent0pt  \\parskip10pt             % make block paragraphs")
      (wl "\\raggedright                            % do not right justify")

      (latex-command "title" (title generator))

      (latex-command "date" "")
      (latex-command "makeindex")

      (latex-command "begin" "document")
      (latex-command "maketitle")
      (latex-command "tableofcontents")
      (dolist (section (contents book))
        (dolist (part section)
          (generate-part part generator)))
      (terpri *latex-stream*)
      (wl "\\addtocontents{toc}{\\protect\\setcounter{tocdepth}{0}}")
      (wl "\\chapter{Reference}")
      (dolist (section (contents book))
        (dolist (part section)
          (generate-part-reference part generator)))
      (terpri *latex-stream*)
      (terpri *latex-stream*)
      (wl "\\chapter{Index}")
      (wl "\\printindex")
      (latex-command "end" "document"))))
Source Context