Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maint(docs): use xelatex for latex docs build (1.7 branch) #20309

Merged
merged 1 commit into from Oct 21, 2020

Conversation

oscarbenjamin
Copy link
Contributor

@oscarbenjamin oscarbenjamin commented Oct 21, 2020

The PDF docs build was failing with

  ! Fatal fontspec error: "cannot-use-pdftex"
  !
  ! The fontspec package requires either XeTeX or LuaTeX.

#20307

This commit changes the release script to use xelatex instead of
pdflatex.

References to other Issues or PRs

Brief description of what is fixed or changed

Other comments

Release Notes

  • other
    • The LaTeX docs now need to built with xelatex rather than pdflatex.

The PDF docs build was failing with

  ! Fatal fontspec error: "cannot-use-pdftex"
  !
  ! The fontspec package requires either XeTeX or LuaTeX.

sympy#20307

This commit changes the release script to use xelatex instead of
pdflatex.
@sympy-bot
Copy link

sympy-bot commented Oct 21, 2020

Hi, I am the SymPy bot (v161). I'm here to help you write a release notes entry. Please read the guide on how to write release notes.

Your release notes are in good order.

Here is what the release notes will look like:

  • other

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.7.

Click here to see the pull request description that was parsed.
The PDF docs build was failing with
```
  ! Fatal fontspec error: "cannot-use-pdftex"
  !
  ! The fontspec package requires either XeTeX or LuaTeX.
```
https://github.com/sympy/sympy/issues/20307

This commit changes the release script to use xelatex instead of
pdflatex.

<!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->

#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more information). Also, please
write a comment on that issue linking back to this pull request once it is
open. -->


#### Brief description of what is fixed or changed


#### Other comments


#### Release Notes

<!-- Write the release notes for this release below. See
https://github.com/sympy/sympy/wiki/Writing-Release-Notes for more information
on how to write release notes. The bot will check your release notes
automatically to see if they are formatted correctly. -->

<!-- BEGIN RELEASE NOTES -->
* other
    * The LaTeX docs now need to built with xelatex rather than pdflatex.
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

@oscarbenjamin oscarbenjamin added Documentation Releasing Issues relating to the automated release scripts. Use milestones to block issues on a release. labels Oct 21, 2020
@oscarbenjamin oscarbenjamin added this to the SymPy 1.7 milestone Oct 21, 2020
@codecov
Copy link

codecov bot commented Oct 21, 2020

Codecov Report

Merging #20309 into 1.7 will increase coverage by 0.008%.
The diff coverage is n/a.

@@              Coverage Diff              @@
##               1.7    #20309       +/-   ##
=============================================
+ Coverage   75.710%   75.719%   +0.008%     
=============================================
  Files          674       674               
  Lines       174162    174162               
  Branches     41098     41098               
=============================================
+ Hits        131859    131874       +15     
+ Misses       36557     36538       -19     
- Partials      5746      5750        +4     

make
# Build with xelatex because pdflatex can not be used with fontspec.
# https://github.com/sympy/sympy/issues/20307
export LATEXMKOPTS='-xelatex -silent'
Copy link
Member

@asmeurer asmeurer Oct 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this used to be done automatically, but it was changed so that you have to set it in 1f1d754. Any reason we can't continue to set it automatically? I actually never understood why we can't just have make pdf that runs make latex and the latex makefile in one step.

CC @sylee957

Copy link
Member

@sylee957 sylee957 Oct 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The option -silent is not necessary for documentation release builds because it only fixes the issues with logs for travis tests.
But -xelatex option can be bound to the makefile itself if there is possible way to do so, However, I'd be against using string substitutions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think modifying the Makefile is better than having it not work unless you set an environment variable. Although if we had make pdf that ran the other Makefile we could just set this variable in the top-level Makefile (not substitutions necessary).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it may be possible to set this via a latexmkrc file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to any suggestions. For now I'm waiting to see if the release script passes with this change.

What I don't understand is why this fontspec issue has come up now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make latex generates another Makefile that builds the pdf. Prior to the commit I referenced, the Makefile was automatically modified with sed to use xelatex, but after @sylee957's PR, the sed was removed and you have to set an environment variable manually.

We really should figure out how to get the release script running on a CI so that we can avoid breaking it. It may also help to somehow share the scripts used on Travis and the release script so that updates to one also change the other.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main manual step involved in running the release script us fixing the authors in .mailmap and AUTHORS.

Sorting that out would mean that every PR from a newer contributor has to update those files.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you run make latex it says that make latexpdf does this, but that doesn't exist in the Makefile. We should probably update our Makefile to the latest standard sphinx Makefile (i.e., what you'd get from sphinx-quickstart in the latest version of Sphinx). We also include a lot of custom stuff, so this might not be straightforward.

@oscarbenjamin
Copy link
Contributor Author

This didn't work:

The LaTeX files are in _build/latex.
Run 'make' in that directory to run these through (pdf)latex
(use `make latexpdf' here to do that automatically).

Build finished; the LaTeX files are in _build/latex.
Set the environment variable LATEXMKOPTS='-xelatex -silent'
And run `make all' in that directory to run these through xelatex.
xonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = <filename>
Traceback (most recent call last):
  File "/opt/conda/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 21877, in _run_binary
    p = self.cls(self.cmd, bufsize=bufsize, **kwargs)
  File "/opt/conda/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 14059, in __init__
    *args, stdin=stdin, stdout=stdout, stderr=stderr, **kwargs
  File "/opt/conda/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/opt/conda/lib/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'export': 'export'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 15332, in __init__
    proc = spec.run(pipeline_group=pipeline_group)
  File "/opt/conda/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 21866, in run
    p = self._run_binary(kwargs)
  File "/opt/conda/lib/python3.6/site-packages/xonsh/__amalgam__.py", line 21888, in _run_binary
    raise XonshError(e)
xonsh.__amalgam__.XonshError: xonsh: subprocess mode: command not found: export
Did you mean one of the following?
    expr:    Command (/usr/bin/expr)
    expiry:  Command (/usr/bin/expiry)
    import:  Command (/usr/bin/import)

@asmeurer
Copy link
Member

I think for xonsh it's $LATEXMKOPTS = '-xelatex -silent'.

@oscarbenjamin
Copy link
Contributor Author

That's what I'm trying in #20316

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Releasing Issues relating to the automated release scripts. Use milestones to block issues on a release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants