I would like to collect my Fortran tweets https://twitter.com/fortrantip
into a PDF where the codes are in boxes with syntax highlighting. What software would you recommend for creating such a document?
I used LaTeX decades ago. It's powerful, but I have forgotten how to use it.
Beliavsky <beli...@aol.com> wrote:
I would like to collect my Fortran tweets https://twitter.com/fortrantip into a PDF where the codes are in boxes with syntax highlighting. What software would you recommend for creating such a document?
I used LaTeX decades ago. It's powerful, but I have forgotten how to use it.I was going to suggest Lout, but that is even more of a niche approach
and you still have to learn the language ;). How about a literate programming tool such as noweb, which can be used from the
WYSIWYG Lyx editor...
I would like to collect my Fortran tweets https://twitter.com/fortrantip into a PDF where the codes are in boxes with syntax highlighting. What software would you recommend for creating such a document?
I used LaTeX decades ago. It's powerful, but I have forgotten how to use it.
Le 10/03/2022 à 16:19, Beliavsky a écrit :
I would like to collect my Fortran tweets https://twitter.com/fortrantip into a PDF where the codes are in boxes with syntax highlighting. What software would you recommend for creating such a document?
I used LaTeX decades ago. It's powerful, but I have forgotten how to use it.Last year, I replaced the LaTeX lstlisting package by the minted package
in my documents:
http://tug.ctan.org/macros/latex/contrib/minted/minted.pdf
It is based on Pygments:
https://pygments.org/
I would like to collect my Fortran tweets https://twitter.com/fortrantip into a PDF where the codes are in boxes with syntax highlighting. What software would you recommend for creating such a document?Sounds something ripe for MS Word mail merge via Excel perhaps.
I used LaTeX decades ago. It's powerful, but I have forgotten how to use it.
I would like to collect my Fortran tweets https://twitter.com/fortrantip into a PDF where the codes are in boxes with syntax highlighting. What software would you recommend for creating such a document?
I used LaTeX decades ago. It's powerful, but I have forgotten how to use it.
. IFRAME gives you more control over geometry than <A....>. Could just do it as a markdown file and convert to HTML, etc. LOTS of options to play with with pandoc. Requires latex to be installed underneath for this particular pandoc command. Not avery robust script, but it shows the steps.
#!/bin/bash
set -x
FFILE=${1:-/tmp/dice.f90}
(
echo '```fortran'
cat $FFILE
echo '```'
) >/tmp/show.md
pandoc /tmp/show.md -s -o /tmp/fortran.pdf --highlight-style=kate -V geometry:margin=1in
cat >/tmp/show.html <<\EOF
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
This is some text to show
<h1>PDF Example with iframe</h1>
<iframe src="fortran.pdf" width="80%" height="500px">
</iframe>
</body>
</html>
EOF
cd /tmp
xdg-open show.html
exit
lfortran fmt code.f90 |ansi2html >code.html
lfortran fmt code.f90 |ansi2html >code.html
worked well with several modern Fortran files for coloring it; ansi2html is at
https://raw.githubusercontent.com/pixelb/scripts/master/scripts/ansi2html.sh
Did not see a way to write HTML directly from lfortran, although I thought there was one.
On Friday, March 11, 2022 at 8:25:20 AM UTC+1, Vincent MAGNIN wrote:
Le 10/03/2022 à 16:19, Beliavsky a écrit :
I would like to collect my Fortran tweets https://twitter.com/fortrantip into a PDF where the codes are in boxes with syntax highlighting. What software would you recommend for creating such a document?Last year, I replaced the LaTeX lstlisting package by the minted package
I used LaTeX decades ago. It's powerful, but I have forgotten how to use it.
in my documents:
http://tug.ctan.org/macros/latex/contrib/minted/minted.pdf
It is based on Pygments:
https://pygments.org/
I use Latex quite a bit and the listlisting package is really nice. I do not know minted.
@beliavsky, we ought to be able to get up and running with Latex again ;). It is not at all difficult, unless you want to do sophisticated things.
Here is a minimalist LaTeX document to start with. Under ubuntu, you
need the package python3-pygments. And you can compile the LaTeX file with:
$ pdflatex -shell-escape poly_algo.tex
\documentclass[12pt,english,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{xcolor}
\definecolor{bg_listing}{rgb}{0.95,0.95,0.95}
\usepackage{minted}
\setminted[Fortran]{linenos, autogobble, breaklines, breakanywhere, bgcolor=bg_listing}
\setminted[Bash]{style=bw, frame=single, breaklines, breakanywhere} \setmintedinline{bgcolor={}}
\begin{document}
\tableofcontents
\chapter{Introduction}
\chapter{Fortran Tip}
\section{Bitwise}
\begin{minted}{Fortran}
program bitwise
implicit none
print*,iand(1,1),iand(1,0),iand(0,1),iand(0,0) ! 1 0 0 0 print*,iand(2,2),iand(2,1),iand(2,0) ! 2 0 0 print*,ior(1,1),ior(1,0),ior(0,1),ior(0,0) ! 1 1 1 0 print*,ieor(1,1),ieor(1,0),ieor(0,1),ieor(0,0) ! 0 1 1 0 print*,iany([1,1]),iany([1,0]),iany([0,0]) ! 1 1 0
end program bitwise
\end{minted}
\end{document}
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 159 |
Nodes: | 16 (0 / 16) |
Uptime: | 100:03:00 |
Calls: | 3,209 |
Files: | 10,563 |
Messages: | 3,009,979 |