cschwan / sage-on-gentoo

(Unofficial) Gentoo Overlay for Sage- and Sage-related ebuilds
84 stars 26 forks source link

pdf-docs fail when building 9.2.beta6 #593

Closed strogdon closed 4 years ago

strogdon commented 4 years ago

I'm not sure if this is the primary source of the failure but I do see

! Package inputenc Error: Unicode character ^^H (U+0008)
(inputenc)                not set up for use with LaTeX.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.4655 \(1,^^H
              eta,\ldots,^^Heta^{sm}\) be the power basis that SageMath uses to

? 
! Emergency stop.
 ...                                              

l.4655 \(1,^^H
              eta,\ldots,^^Heta^{sm}\) be the power basis that SageMath uses to

!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on coding.log.

I will try to build on vanilla to see if it is present there.

slel commented 4 years ago

Something goes wrong with the \b from \beta from this line, I'm curious why:

https://github.com/sagemath/sage/blob/ddaba54f6d69276ed1b9c60193ace839542eb5a9/src/sage/coding/linear_rank_metric.py#L156

strogdon commented 4 years ago

I see this with vanilla also. Now it could be that my texlive-2020-r6 is not complete.

slel commented 4 years ago

The problem seems to be with \b being interpreted as a single unicode character instead of two ascii characters \ and b.

strogdon commented 4 years ago

This is what sphinx generates in coding.tex:

\item {}
\sphinxcode{\sphinxupquote{basis}} \textendash{} (default: \sphinxcode{\sphinxupquote{None}}) a basis of \(F_{q^m}\) as a vector space over
\sphinxcode{\sphinxupquote{sub\_field}}. If not specified, given that \(q = p^s\), let
\(1,^Heta,\ldots,^Heta^{sm}\) be the power basis that SageMath uses to
represent \(F_{q^m}\). The default basis is then \(1,^Heta,\ldots,beta^{m-1}\).

The \b has been converted to ^H. I also see a typo in the beta^{m-1} expression.

strogdon commented 4 years ago

If I do make clean and then make and press enter enough times in /var/tmp/portage/sci-mathematics/sage-9999/work/build_doc/latex/en/reference/coding, coding.pdf is generated and the \beta seems to be correctly typeset.

strogdon commented 4 years ago

The lines around https://github.com/sagemath/sage/blob/ddaba54f6d69276ed1b9c60193ace839542eb5a9/src/sage/coding/linear_rank_metric.py#L156 appear six times in linear_rank_metric.py but only four times in coding.tex. Of these four occurrences two have \beta correctly the other two have \b replaced with ^H. And the places where \b is replaced with ^H typesetting is NOT correct in coding.pdf.

kiwifb commented 4 years ago

Do we know what sphinx uses to spit out its latex? It is somewhat reminiscent of #574 which was caused by the non-portability of echo between various shell.

strogdon commented 4 years ago

I wonder if this line https://github.com/sagemath/sage/blob/ddaba54f6d69276ed1b9c60193ace839542eb5a9/src/sage/coding/linear_rank_metric.py#L238 is confusing things.

strogdon commented 4 years ago

Nope. The above, though incorrect, is not the cause.

kiwifb commented 4 years ago

Just to see if it has an impact can you try the following

strogdon commented 4 years ago

This seemed to fix things using vanilla.

diff --git a/src/sage/coding/linear_rank_metric.py b/src/sage/coding/linear_rank_metric.py
index 931173f660..7e1cc8e922 100644
--- a/src/sage/coding/linear_rank_metric.py
+++ b/src/sage/coding/linear_rank_metric.py
@@ -247,8 +247,8 @@ def rank_weight(c, sub_field=None, basis=None):

     - ``basis`` -- (default: ``None``) a basis of `F_{q^m}` as a vector space over
       ``sub_field``. If not specified, given that `q = p^s`, let
-      `1,\beta,\ldots,\beta^{sm}` be the power basis that SageMath uses to
-      represent `F_{q^m}`. The default basis is then `1,\beta,\ldots,beta^{m-1}`.
+      `1,\\beta,\ldots,\\beta^{sm}` be the power basis that SageMath uses to
+      represent `F_{q^m}`. The default basis is then `1,\\beta,\ldots,beta^{m-1}`.

     EXAMPLES::

@@ -284,8 +284,8 @@ def rank_distance(a, b, sub_field=None, basis=None):

     - ``basis`` -- (default: ``None``) a basis of `F_{q^m}` as a vector space over
       ``sub_field``. If not specified, given that `q = p^s`, let
-      `1,\beta,\ldots,\beta^{sm}` be the power basis that SageMath uses to
-      represent `F_{q^m}`. The default basis is then `1,\beta,\ldots,beta^{m-1}`.
+      `1,\\beta,\ldots,\\beta^{sm}` be the power basis that SageMath uses to
+      represent `F_{q^m}`. The default basis is then `1,\\beta,\ldots,beta^{m-1}`.

     EXAMPLES::

These are the only two locations where \b was replaced with ^H. But I don't see what is triggering the issue.

kiwifb commented 4 years ago

Definitely feels like an echo kind of issue. In any case, this belongs to trac @slel will you shepherd the issue?

kiwifb commented 4 years ago

Got it. it is """ versus r""" I am sure. The ones that are treated correctly are r""" and the failing ones are just """.

strogdon commented 4 years ago

Oh my, and I thought I had checked that!

kiwifb commented 4 years ago

Having two people checking things really does help. But checking that it fixes the issues is the top priority here.

strogdon commented 4 years ago

I'm running things again.

strogdon commented 4 years ago
diff --git a/src/sage/coding/linear_rank_metric.py b/src/sage/coding/linear_rank_metric.py
index 931173f660..a2a282fd20 100644
--- a/src/sage/coding/linear_rank_metric.py
+++ b/src/sage/coding/linear_rank_metric.py
@@ -232,7 +232,7 @@ def from_matrix_representation(w, base_field=None, basis=None):
     return vector(v)

 def rank_weight(c, sub_field=None, basis=None):
-    """
+    r"""
     Returns the rank of ``c`` as a matrix over ``sub_field``.

     If ``c`` is a vector over some field `F_q{q^m}`, the function converts it
@@ -263,7 +263,7 @@ def rank_weight(c, sub_field=None, basis=None):
     return c.rank()

 def rank_distance(a, b, sub_field=None, basis=None):
-    """
+    r"""
     Returns the rank of ``a`` - ``b`` as a matrix over ``sub_field``.

does fix things on vanilla. I had to clean out the docs, remake the html-docs and then the pdf-docs. The pdf-docs do build. I didn't touch the typos mentioned above.

kiwifb commented 4 years ago

This is now https://trac.sagemath.org/ticket/30230

kiwifb commented 4 years ago

@strogdon if you have a branch to attach to the ticket you are welcome to do so.

strogdon commented 4 years ago

Good I just started doing that. I'll try to attach a branch.

kiwifb commented 4 years ago

I believe we can close this now :)