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

docker for latex #891

Merged
merged 2 commits into from
Dec 9, 2018
Merged

docker for latex #891

merged 2 commits into from
Dec 9, 2018

Conversation

fredrikekre
Copy link
Member

No description provided.

@fredrikekre fredrikekre force-pushed the fe/docker-latex branch 3 times, most recently from 180e10a to 1dba321 Compare November 23, 2018 12:17
@fredrikekre
Copy link
Member Author

Seems to be some file permission mismatch in the docker container:
Cannot write file 'Documenter.jl.aux'

src/Writers/LaTeXWriter.jl Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
@fredrikekre fredrikekre force-pushed the fe/docker-latex branch 6 times, most recently from e916687 to b6e5d3e Compare December 1, 2018 23:35
@fredrikekre
Copy link
Member Author

Ok. This works now.

@fredrikekre fredrikekre added the Format: LaTeX Related to the LaTeX / PDF output label Dec 1, 2018
assets/latex/documenter.sty Outdated Show resolved Hide resolved
src/Writers/LaTeXWriter.jl Outdated Show resolved Hide resolved
@mortenpi
Copy link
Member

mortenpi commented Dec 2, 2018

I tried running the latexmk backend locally with julia test/formats/latex.jl, and I am getting the following:

[ Info: LaTeXWriter: using latexmk to compile tex.
┌ Error: LaTeXWriter: failed to compile tex with latexmk. Logs and partial output can be found in `/tmp/tmpv14bh5`.
│   exception = UndefVarError: file not defined
└ @ Documenter.Writers.LaTeXWriter ~/Julia/JuliaDocs/Documenter/src/Writers/LaTeXWriter.jl:107
Test Summary: | Pass  Total
LaTeX         |    1      1

The PDF looks fine though.

I am also not seeing any latexmk logs anywhere though. I see that they should just be going to stdout/-err?

Also, interestingly, it seems that HTMLWriter gets called too, because I end up with the .html files in the temporary directory too:

$ ls -Alh /tmp/tmpv14bh5/
total 516K
drwxrwxr-x  2 mortenpi mortenpi 4.0K Dec  2 20:53 assets
drwxrwxr-x  2 mortenpi mortenpi 4.0K Dec  2 20:53 contributing
-rw-rw-r--  1 mortenpi mortenpi    0 Dec  2 20:53 custom.sty
-rw-rw-r--  1 mortenpi mortenpi 251K Dec  2 20:53 Documenter.jl.pdf
-rw-rw-r--  1 mortenpi mortenpi  78K Dec  2 20:53 Documenter.jl.tex
-rw-rw-r--  1 mortenpi mortenpi 1.5K Dec  2 20:53 documenter.sty
-rw-rw-r--  1 mortenpi mortenpi 7.1K Dec  2 20:53 index.html
drwxrwxr-x  4 mortenpi mortenpi 4.0K Dec  2 20:53 lib
drwxrwxr-x 10 mortenpi mortenpi 4.0K Dec  2 20:53 man
drwxrwxr-x  2 mortenpi mortenpi 4.0K Dec  2 20:53 search
-rw-rw-r--  1 mortenpi mortenpi 152K Dec  2 20:53 search_index.js

I'll try to debug further tomorrow.

@fredrikekre
Copy link
Member Author

fredrikekre commented Dec 2, 2018

Also, interestingly, it seems that HTMLWriter gets called too

Maybe you had some old files around that got copied? This PR does not touch the dispatching code at all so...

Edit: The pdf must also have been old, because the UndefVarError was thrown before actually compiling.

src/Writers/LaTeXWriter.jl Outdated Show resolved Hide resolved
@mortenpi
Copy link
Member

mortenpi commented Dec 3, 2018

Maybe you had some old files around that got copied? This PR does not touch the dispatching code at all so...

Right, my bad. My docs/build/ was dirty and forgot that we copy that over to /tmp. With your latest updates, it seems to build fine, but latexmk still runs into some errors:

[ Info: LaTeXWriter: using latexmk to compile tex.
┌ Error: LaTeXWriter: failed to compile tex with latexmk. Logs and partial output can be found in `/tmp/tmpj3fw2C`.
│   exception = failed process: Process(`latexmk -f -interaction=nonstopmode -view=none -lualatex -shell-escape Documenter.jl.tex`, ProcessExited(12)) [12]
└ @ Documenter.Writers.LaTeXWriter ~/Julia/JuliaDocs/Documenter/src/Writers/LaTeXWriter.jl:115
Test Summary: | Pass  Total
LaTeX         |    1      1

And from Documenter.log:

! LaTeX Error: Something's wrong--perhaps a missing \item.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.139 \end{itemize}

I've put the full output here: https://gist.github.com/mortenpi/d103b0e4bbb19b6ef5a1e842e81e0b71

@mortenpi
Copy link
Member

mortenpi commented Dec 3, 2018

Ah, it looks like if we have an empty index block (which happened right now, since for some reason Documenter can't find docstrings when running the test/format/latex.jl script), we get an empty itemize:

\subsection{Index}



A list of all internal documentation sorted by module.


\begin{itemize}
\end{itemize}


\hypertarget{3430565549354646931}{}

This (possibly stupid) patch fixes the problem:

diff --git a/src/Writers/LaTeXWriter.jl b/src/Writers/LaTeXWriter.jl
index 8253dc2c..5ef16de1 100644
--- a/src/Writers/LaTeXWriter.jl
+++ b/src/Writers/LaTeXWriter.jl
@@ -250,6 +250,7 @@ end
 ## Index, Contents, and Eval Nodes.
 
 function latex(io::IO, index::Documents.IndexNode, page, doc)
+    length(index.elements) > 0 || return
     _println(io, "\\begin{itemize}")
     for (object, _, page, mod, cat) in index.elements
         id = string(hash(string(Utilities.slugify(object))))
@@ -263,6 +264,7 @@ function latex(io::IO, index::Documents.IndexNode, page, doc)
 end
 
 function latex(io::IO, contents::Documents.ContentsNode, page, doc)
+    length(contents.elements) > 0 || return
     depth = 1
     needs_end = false
     _println(io, "\\begin{itemize}")

src/Documenter.jl Outdated Show resolved Hide resolved
src/Documenter.jl Outdated Show resolved Hide resolved
docs/make.jl Outdated Show resolved Hide resolved
@fredrikekre fredrikekre force-pushed the fe/docker-latex branch 3 times, most recently from cc3ca96 to cd1bea4 Compare December 7, 2018 11:06
@fredrikekre
Copy link
Member Author

I'm thinking that I update the CHANGELOG and then this is good to go from my side

@fredrikekre fredrikekre changed the title WIP docker for latex. docker for latex Dec 7, 2018
.travis.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
docs/src/lib/internals/formats.md Show resolved Hide resolved
src/Documents.jl Outdated Show resolved Hide resolved
src/Writers/LaTeXWriter.jl Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
src/Writers/LaTeXWriter.jl Outdated Show resolved Hide resolved
test/runtests.jl Outdated Show resolved Hide resolved
test/examples/tests.jl Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
docs/make.jl Outdated Show resolved Hide resolved
@fredrikekre
Copy link
Member Author

I'd like to merge this to try it out and then fix any remainiing things in follow up PRs before the 0.21 release.

@fredrikekre
Copy link
Member Author

I'll have a look at coverage later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Format: LaTeX Related to the LaTeX / PDF output
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants