Giter VIP home page Giter VIP logo

Comments (2)

tpetricek avatar tpetricek commented on June 21, 2024

Hi,
having a way to generate PDF output from the document would be great. I quite like the LaTeX option (this would be nice for people like me who occasionally want to include some F# code in academic publications, which often require LaTeX).

As for the packages used, the pdfcomment looks quite nice (but I agree that tooltips do not make that much sense in PDF). The listings package seems to take care of the colouring itself (the text in the document is just plain text). I suppose that if you want to generate LaTeX, you would generate code with all the formatting (based on the AST, just like when generating HTML), so I do not see how this would work (but definitely, give it a try! I'm a LaTeX beginner :-)).

It might be worth checking out how lhs2TeX works - which is a similar tool for Haskell.

Thanks for your interest in doing this! Having PDF output would be really great!

from fsharp.formatting.

dungpa avatar dungpa commented on June 21, 2024

I finally have some time to work on a pull request.

I abandon tooltips completely because we don't need them in PDFs.

Regarding source code highlighting, I narrow to choose one in three packages: fancyvrb, minted and listings.

  • fancyvrb: pros - easy to customize with commands; cons - hard to set background color and word wrapping.
  • minted: pros - extending fancyvrb with advanced options; cons - hard to set up and having external dependencies (Python, etc).
  • listings: pros - supporting background color and word wrapping; cons - hard to extend the current setting.

Right now I implement fancyvrb to colorize F# source code and listings to format other languages. I tried to extend listings in the same way I did with fancyvrb but failed. Otherwise, using only listings is the preferred option.

When writing conversion from Markdown to LaTeX, I notice HtmlBlock. LaTeX doesn't support inline HTML, so I escape those strings and display them as is. In the future, we may need to parse HTML and convert to LaTEX.
And the fact that we format snippets as HtmlBlock before displaying is confusing since it is not the only way the snippets should be processed.

I took a look at lhs2TeX. We can generate beautiful type-set source code with math symbols like them if we handle Markdown math extensions. One might have to annotate to recognize which bits need to be type-set. I'm just toying the idea with template-math.tex template.

Please take a look at the #14 issue.

from fsharp.formatting.

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.