sean-fitzpatrick / Math3410

Open textbook on linear algebra featuring python code.
0 stars 4 forks source link

Some encountered problems when converting this repository to html/tex files. #4

Closed hongyi-zhao closed 3 years ago

hongyi-zhao commented 3 years ago

I generated a TeX file of this project with the following steps.

I use the mathbook.git as the local repo name instead of mathbook, so adapt the 3410-html.xsl to avoid the problem reported here:

$ git diff
diff --git a/style/3410-html.xsl b/style/3410-html.xsl
index 4871c0d..a693263 100644
--- a/style/3410-html.xsl
+++ b/style/3410-html.xsl
@@ -2,7 +2,7 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

 <!-- Thin layer on MathBook XML -->
-<xsl:import href="../../mathbook/xsl/pretext-html.xsl" />
+<xsl:import href="../../mathbook.git/xsl/pretext-html.xsl" />

 <!-- String parameters -->

And prepare some configurations with the xsl style files supplied by Math3410.

$ cd mathbook.git
$ mkdir user
$ cd user
$ ln -sr pretext/pretext.cfg .
$ ln -sr ../../sean-fitzpatrick/Math3410.git/style/3410-* .

The html/TeX files can be generated in the following way:

$ cd Math3410.git
$ mkdir test
$ cd test

$ xsltproc --stringparam publisher ../publication/publication.xml --xinclude ../../../rbeezer/mathbook.git/user/3410-html.xsl ../ptx/3410notes.ptx
********************************************************************************
Hypothes.is annotation is experimental
********************************************************************************

$ xsltproc --stringparam publisher ../publication/publication.xml --xinclude ../../../rbeezer/mathbook.git/user/3410-latex-style.xsl ../ptx/3410notes.ptx -o 3410-latex-style.tex
warning: failed to load external entity "-o"
unable to parse -o
3410-latex-style.tex:1: parser error : Start tag expected, '<' not found
%********************************************%
^
unable to parse 3410-latex-style.tex

$ xsltproc --stringparam publisher ../publication/publication.xml --xinclude ../../../rbeezer/mathbook.git/user/3410-latex-print-style.xsl ../ptx/3410notes.ptx -o 3410-latex-print-style.tex
warning: failed to load external entity "--output"
unable to parse --output
3410-latex-print-style.tex:1: parser error : Start tag expected, '<' not found
%********************************************%
^
unable to parse 3410-latex-print-style.tex

In the generated tex file, I find the following line:

$ egrep video-1.jpg 3410-latex-print-style.tex 
\includegraphics[width=0.80\linewidth,height=\qrsize,keepaspectratio]{images/video-1.jpg}%

But the file video-1.jpg doesn't exist in this repo at all. Any hints for this problem will be highly appreciated.

Another problem is that the figures are located under the figures directory in this repo, while the generated tex file will refer to a non-existent images directory for finding these figures.

Thirdly, the svg figures supplied under the figures directory can't be directly used by latex without some additional packages help as discussed here, so the conversion similar to the following command should be done in advance, if necessary latex package isn't used, say, this one:

$ inkscape basis_cube.svg --export-pdf=basis_cube.pdf
$ inkscape img_trans_matrix.svg --export-pdf=img_trans_matrix.pdf

Regards, HY

sean-fitzpatrick commented 3 years ago

video-1.jpg is a YouTube thumbnail. You have to generate it. This is one of the steps in PreTeXt processing, as described in the guide. You can look there to see how videos are handled.

Images that are not generated from source are provided in the figures folder. You copy them into your output folders. Output directories are not tracked by git.

I am not able to create your output folder structure for you.

hongyi-zhao commented 3 years ago

You can look there to see how videos are handled.

Where? What's link/URL?

Output directories are not tracked by git.

I confirmed this setting here.

sean-fitzpatrick commented 3 years ago

The PreTeXt script is described here. You can run it with the -h option to see what the command is for video.

hongyi-zhao commented 3 years ago

Got it, thanks a lot.