Documentation

BlueprintGen.Output

Here, we convert nodes and docstrings to LaTeX. The main difficulty is converting Markdown to LaTeX, which we describe below.

@[reducible, inline]
Equations
Instances For

    We convert docstrings of declarations and modules to LaTeX. Besides the usual Markdown features, we also support citations using square brackets and references using inline code, by having custom commands and postprocessing steps, as follows:

    1. Using MD4Lean, we parse the markdown.
    2. If possible, we convert bracketed citations (e.g. [taylorwiles]) to \cite{taylorwiles} commands.
    3. If possible, we convert inline code with a constant (e.g. abc) to \ref{abc} commands.
    4. We convert the markdown to LaTeX macro definitions as output.

    TODO: Support doc-gen4 style named citations like [abc][def].

    The output provides the following macros:

    The long-term goal for blueprint-gen is to migrate to Verso and not have to output to LaTeX at all. Here, this would mean using docstring parsing from Verso instead (which similarly uses MD4Lean to parse the docstrings), and it has support for elaborating code blocks. However, AFAIK it currently does not support citations in docstrings.

    Escapes a string in LaTeX for all LaTeX environments (text, math, leancode, links, etc.).

    Equations
    Instances For

      Escapes a string in LaTeX for text.

      Equations
      Instances For

        Escape # and convert brackets [taylorwiles] to \cite{taylorwiles} commands.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          partial def BlueprintGen.postprocessMarkdownText.findAllEnclosed (s : String) (bracketStart bracketEnd : Char) (notFollowedBy : CharBool) (i : String.Pos := 0) (ret : Array String := ) :

          Parse and convert markdown to LaTeX using MD4Lean with postprocessing steps as above.

          Equations
          Instances For
            Equations
            Instances For
              def BlueprintGen.NodePart.toLatex {m : TypeType} [Monad m] [Lean.MonadOptions m] (part : NodePart) (title : Option String) (additionalContent : String) :
              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  Equations
                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For

                      Convert imported module to LaTeX.

                      Equations
                      Instances For

                        Convert current module to LaTeX (for debugging).

                        Equations
                        Instances For

                          Shows the blueprint LaTeX of the current module for debugging.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For

                                Shows the blueprint JSON of the current module for debugging.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    def BlueprintGen.outputResultsWithExt (basePath : System.FilePath) (module : Lean.Name) (content ext : String) :

                                    Write the result content to the appropriate blueprint file with extension ext ("tex" or "json").

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      def BlueprintGen.outputLatexResults (basePath : System.FilePath) (module : Lean.Name) (latex : Latex) :

                                      Write latex to the appropriate blueprint tex file.

                                      Equations
                                      Instances For

                                        Write json to the appropriate blueprint json file.

                                        Equations
                                        Instances For

                                          Write to an appropriate index tex file that \inputs all modules in a library.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For

                                            Write to an appropriate index json file containing paths to json files of all modules in a library.

                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For