Streaming LaTeX (via GitHub) into Pressbooks

I’m working with a student to try and translate a open textbook written in LaTeX (and running out of a GitHub repository) into Pressbooks. Is anyone else doing this? It is proving to be a bit difficult and the closest we have got so far is translating the LaTeX into an epub and then pushing the epub into Pressbooks, which I am told can convert epub to html.

Any advice/insight/tools others have to do this work would be great.

-Stephanie

Hi Stephanie & welcome to the Pressbooks forum! We’ve got a chapter on using LaTeX in our guide that might be useful: https://guide.pressbooks.com/chapter/equations-and-formulas/. I’m not sure if you’re using the open source version of Pressbooks, but we provide the WP QuickLaTeX plugin for EDU hosted users which gives heavy math notation users a few more settings and options for rendering expressions and configuring output. Hope that helps as a start?

Thanks,
I’m the student working with Stephanie. I’ve familiarized myself with using QuickLaTeX for individual equations and figures, but I found that even using the ‘Use LaTeX Syntax Sitewide’ option I was not able to copy larger portions of an existing textbook written in Latex into Pressbooks.

For reference, the textbook is a sentential logic textbook that uses Latex’s mathematical typesetting to express logical statements and uses a system of trees and diagrams to help students understand proof structure. Here is a link to the Github repository for the textbook:

We are interested in creating a version of the book on Pressbooks so that the book could be read as an eBook, instead of just a PDF, and so that the book could be assigned an ISBN.

Since the book is updated every semester, I am looking to see if there is a streamlined way to get the Latex code into Pressbooks. Then, the professor could continue to make updates to the Latex files and once a semester upload an updated version.

My plan is to look into existing tools to covert Latex to HTML or EPUB formats and then use the ‘Import’ option to bring the converted file into Pressbooks.

I was wondering if you know of anyone that has worked on something similar.

Hi Guys,

I just want to say that I’m very aware of Forallx, because at one point I tried to do the exact same project.

I wonder if the work I had started would be of any help.
https://oer.ed-beck.com/forallx/

I was working with PD Magnus’ original version, and not not Jonathan Ichikawa’s remix, but I wonder if any part of it might be helpful to you.

Particularly I spent a lot of time working out how to do the fitch proofs later in the book.

That looks great!
Did you end up using QuickLatex for the Fitch proofs, or did you implement them directly in HTML?

Also, were you able to import large portions of the book, or did you need to add most of the content manually?

I ended up doing too much manually. This was the first major project I took on in Pressbooks, and I eventually abandoned it because of higher priority projects.

PD did not use standard language for his proofs, and wrote his own style sheet.

I added this in the advanced tab of quicklatex


\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{mdwtab}
\usepackage{ifthen}
\usepackage{latexsym}

% Line height in proofs
\newlength{\fitchlineht}
\setlength{\fitchlineht}{1.5\baselineskip}
% Horizontal indent between proof levels
\newlength{\fitchindent}
\setlength{\fitchindent}{0.7em}
% Indent to comment
\newlength{\fitchcomind}
\setlength{\fitchcomind}{2em}
% Line number width
\newlength{\fitchnumwd}
\setlength{\fitchnumwd}{1em}

% Altered from mdwtab.sty: shorter vline, for start of subproof
\makeatletter
\newcommand\fvline[1][\arrayrulewidth]{\vrule@height.5\fitchlineht@width#1\relax}
\makeatother
% Ordinary vertical line
\newcommand{\fa}{\vline\hspace*{\fitchindent}}
% Vertical line, shorter: Use at start of (sub)proof
\newcommand{\fb}{\fvline\hspace*{\fitchindent}}
% Hypothesis
\newcommand{\fh}{\fvline%
\makebox[0pt][l]{{%
\raisebox{-1.4ex}[0pt][0pt]{\rule{1.5em}{\arrayrulewidth}}}}%
\hspace*{\fitchindent}}
% Hypothesis, with longer vert line: for >1 hypothesis
\newcommand{\fj}{\vline%
\makebox[0pt][l]{{%
\raisebox{-1.4ex}[0pt][0pt]{\rule{1.5em}{\arrayrulewidth}}}}%
\hspace*{\fitchindent}}
% Modal subproof: takes argument = operator
\newcommand{\fitchmodal}[1]{%
\makebox[0pt][r]{${}^{#1}$,}\fvline\hspace*{\fitchindent}}
\newcommand{\fn}{\fitchmodal{\Box}}% Box subproof
\newcommand{\fp}{\fitchmodal{\Diamond}}% Diamond subproof
% Modal subproof with hypothesis in first line (as in Fitch)
\newcommand{\fitchmodalh}[1]{%
\makebox[0pt][r]{${}^{#1}$,}%
\fvline%
\makebox[0pt][l]{{%
\raisebox{-1.4ex}[0pt][0pt]{\rule{1.5em}{\arrayrulewidth}}}}%
\hspace*{\fitchindent}}
% Rule: formula introduction marker. \fr with line, \fs without line
\newcommand{\fr}{%
\makebox[0pt][r]{${\rhd}$,,}\vline\hspace*{\fitchindent}}
\newcommand{\fs}{%
\makebox[0pt][r]{${\rhd}$,,}}
% Box around argument, like new variable in ql
\newcommand{\fw}[1]{\fbox{\footnotesize $#1$}}

%
\newcounter{fitchcounter}
\setcounter{fitchcounter}{0}
%To avoid starting from 1, \setboolean{resetfitchcounter}{false}
\newboolean{resetfitchcounter}
\setboolean{resetfitchcounter}{true}
%To avoid increasing numbers, \setboolean{increasefitchcounter}{false}
\newboolean{increasefitchcounter}
\setboolean{increasefitchcounter}{true}
%\formatfitchcounter can be altered if need be, though only once per proof
\newcommand{\formatfitchcounter}[1]{\scriptsize \arabic{#1}}
%Typeset the counter
\newcommand{\fitchcounter}{%
\ifthenelse{\boolean{increasefitchcounter}}{\addtocounter{fitchcounter}{1}}{}
\formatfitchcounter{fitchcounter}}

%A line with a special number – a tag, e.g. \ftag{\vdots}{}
\newcommand{\ftag}[2]{\multicolumn{1}%
{!{\makebox[\fitchnumwd][r]{#1}\hspace{\fitchindent}}Ml@{\hspace{\fitchcomind}}}%
{#2}}

\newenvironment{fitchnum}%
{\ifthenelse{\boolean{resetfitchcounter}}{\setcounter{fitchcounter}{0}}{}
\begin{tabular}{!{\makebox[\fitchnumwd][r]{\fitchcounter }\hspace{\fitchindent}}Ml@{\hspace{\fitchcomind}}l}}%
{\end{tabular}}

\newenvironment{fitchunum}%
{\begin{tabular}{!{\makebox[\fitchnumwd][r]{}\hspace{\fitchindent}}Ml@{\hspace{\fitchcomind}}l}}%
{\end{tabular}}

\newenvironment{fitch}{\renewcommand{\arraystretch}{1.5}
\begin{fitchnum}}{\end{fitchnum}}
\newenvironment{fitch*}{\renewcommand{\arraystretch}{1.5}
\begin{fitchunum}}{\end{fitchunum}}

% The following is useful for giving a numbered formula, then the proof.
\newenvironment{flem}[2]%
{\begin{eqnarray}
\label{#2}\
&\begin{fitch}}%
{\end{fitch}\notag\end{eqnarray}}

%To write comment field for two consecutive lines, with brace
\newcommand{\ftwocom}[1]{%
\parbox[t]{3cm}{
\raisebox{-.6\baselineskip}[\baselineskip][0pt]{%
$\left.
\begin{aligned}
,\ ,
\end{aligned}
\right}$\quad #1}
}}


Seeing your post has made me try to pick up this project again. Back when I first tried this, I did a lot of cutting and pasting and too much manual work. I am wondering now if I could export the LaTeX > EPUB or HTML and have an easier time loading into Pressbooks.

I tried to export the LaTeX to a an EPUB, and then import that into Pressbooks.

Didn’t work great…

Link to epub
Link to Pressbooks import

I don’t know if either are valuable to you, because it is still going to take a lot of manual fixing, but you are welcome to the EPUB or to clone the book.