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

Feature/journal pdf endpoint #280

Merged
merged 20 commits into from
Dec 17, 2020
Merged

Conversation

leothomas
Copy link
Collaborator

What I did:

Implemented a journal "flavour" pdf creation. The journal flavour:

  • Adds mandatory Discussion and Acknowledgements sections
  • Omits table of contents
  • Double spaces lines
  • Add line numbering

I modified the following in both the journal and the regular "flavours" of pdf:

  • All links are black
  • Table cell contents wrap if text overflows
  • Algorithm input variables and Algorithm output variables now handle input as a WYSIWYG element (as opposed to a text element)
  • Adds a caption for table (assuming a "caption" item is present in the table's WYSIWIG element)
  • Ensured that references are included in the document (the reference must be referenced somewhere in the document, using the ref property)

Whereas the regular pdf generation can be triggered at the endpoint /atbds/alias/{atbd-alias}.pdf , journal "flavour" pdfs can be generated by requesting the following URL: /atbds/journal/alias/{atbd-alias}.pdf

How I did it:

Most changes are contained with serialize.py. I added a table (with overflowing cell content), additional algorithm input variables and references to the testData.sql file for local development/testing purposes.

How you can test it:

Spin up a local instance of the backend server using; ./startServer.sh and point your url to http://localhost:8000/atbds/journal/alias/test-atbd-1.pdf. A journal flavour pdf should be generated.

Note:

The features in this PR are ready to be tested. The following things need to be addressed before the issue can be considered complete:

  • Graceful equation breaking
  • General code cleanup (remove print statements)

ATBD examples:

@leothomas leothomas self-assigned this Dec 4, 2020
@leothomas
Copy link
Collaborator Author

Addresses: NASA-IMPACT/nasa-apt-frontend#162

@danielfdsilva
Copy link
Collaborator

@leothomas pushed a commit to this branch adding another ATBD fixture with more data.

Also tested the pdf and only the normal one is working.

What I did

  • Checkout the code
  • Run ./startserver.sh
  • Through the frontend hit the Download Journal button: localhost:8000/atbds/journal/alias/test-atbd-1.pdf

Errors with:

{
  "detail": "{'stderr': '', 'stdout': \"This is XeTeX, Version 3.14159265-2.6-0.99999 (TeX Live 2019/dev/Debian) (preloaded format=xelatex)\\n \\\\write18 enabled.\\nentering extended mode\\nLaTeX2e <2018-12-01>\\n(/tmp/nasa-apt-pdf-service-7ycno4kt/tmp0klbhwyg.tex\\n(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls\\nDocument Class: article 2018/09/03 v1.4i Standard LaTeX document class\\n(/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo))\\n(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/l3packages/xparse/xparse.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3-code.tex)\\n(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def)))\\n(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/base/tuenc.def))\\n(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.cfg)))\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg)\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/xetex.def))\\n(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty\\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty\\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)\\n(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def)\\n(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg)\\n(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty))\\n(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hxetex.def\\n(/usr/share/texlive/texmf-dist/tex/latex/hyperref/puenc.def)\\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/stringenc.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))\\n(/usr/share/texlive/texmf-dist/tex/latex/booktabs/booktabs.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)))\\n(/usr/share/texlive/texmf-dist/tex/latex/float/float.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/setspace/setspace.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/lineno/lineno.sty)\\nNo file tmp0klbhwyg.aux.\\n(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty\\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))\\n\\nPackage hyperref Warning: Rerun to get /PageLabels entry.\\n\\n\\nLaTeX Warning: No \\\\author given.\\n\\n\\nLaTeX Font Warning: Font shape `TU/LatinModernMath(0)/bx/n' undefined\\n(Font)              using `TU/LatinModernMath(0)/m/n' instead on input line 115\\n.\\n\\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/se-ascii-print.def)\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 116--116\\n\\n\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 116--116\\n\\n\\nOverfull \\\\hbox (72.0pt too wide) in paragraph at lines 116--116\\n [][] \\n\\nLaTeX Warning: Citation `REFone' on page 1 undefined on input line 119.\\n\\n\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 119--120\\n\\n\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 119--120\\n\\n[1]\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 124--124\\n\\n\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 124--124\\n\\n[2] [3]\\nOverfull \\\\hbox (58.0pt too wide) in paragraph at lines 136--137\\n[] \\n\\nOverfull \\\\hbox (58.0pt too wide) in paragraph at lines 139--140\\n[] \\n[4]\\n! Undefined control sequence.\\nl.166 \\\\Discussion\\n                 \\n? \\n! Emergency stop.\\nl.166 \\\\Discussion\\n                 \\nOutput written on tmp0klbhwyg.pdf (4 pages).\\nTranscript written on tmp0klbhwyg.log.\\nThis is BibTeX, Version 0.99d (TeX Live 2019/dev/Debian)\\nThe top-level auxiliary file: tmp0klbhwyg.aux\\nI found no \\\\bibdata command---while reading file tmp0klbhwyg.aux\\nI found no \\\\bibstyle command---while reading file tmp0klbhwyg.aux\\n(There were 2 error messages)\\nThis is XeTeX, Version 3.14159265-2.6-0.99999 (TeX Live 2019/dev/Debian) (preloaded format=xelatex)\\n \\\\write18 enabled.\\nentering extended mode\\nLaTeX2e <2018-12-01>\\n(/tmp/nasa-apt-pdf-service-7ycno4kt/tmp0klbhwyg.tex\\n(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls\\nDocument Class: article 2018/09/03 v1.4i Standard LaTeX document class\\n(/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo))\\n(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/l3packages/xparse/xparse.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3-code.tex)\\n(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def)))\\n(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/base/tuenc.def))\\n(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.cfg)))\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg)\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/xetex.def))\\n(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty\\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty\\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)\\n(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def)\\n(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg)\\n(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty))\\n(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hxetex.def\\n(/usr/share/texlive/texmf-dist/tex/latex/hyperref/puenc.def)\\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/stringenc.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))\\n(/usr/share/texlive/texmf-dist/tex/latex/booktabs/booktabs.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)))\\n(/usr/share/texlive/texmf-dist/tex/latex/float/float.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/setspace/setspace.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/lineno/lineno.sty) (./tmp0klbhwyg.aux)\\n(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty\\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))\\n(./tmp0klbhwyg.out) (./tmp0klbhwyg.out)\\n\\nLaTeX Warning: No \\\\author given.\\n\\n\\nLaTeX Font Warning: Font shape `TU/LatinModernMath(0)/bx/n' undefined\\n(Font)              using `TU/LatinModernMath(0)/m/n' instead on input line 115\\n.\\n\\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/se-ascii-print.def)\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 116--116\\n\\n\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 116--116\\n\\n\\nOverfull \\\\hbox (72.0pt too wide) in paragraph at lines 116--116\\n [][] \\n\\nLaTeX Warning: Citation `REFone' on page 1 undefined on input line 119.\\n\\n\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 119--120\\n\\n\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 119--120\\n\\n[1]\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 124--124\\n\\n\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 124--124\\n\\n[2] [3]\\nOverfull \\\\hbox (58.0pt too wide) in paragraph at lines 136--137\\n[] \\n\\nOverfull \\\\hbox (58.0pt too wide) in paragraph at lines 139--140\\n[] \\n[4]\\n! Undefined control sequence.\\nl.166 \\\\Discussion\\n                 \\n? \\n! Emergency stop.\\nl.166 \\\\Discussion\\n                 \\nOutput written on tmp0klbhwyg.pdf (4 pages).\\nTranscript written on tmp0klbhwyg.log.\\nThis is XeTeX, Version 3.14159265-2.6-0.99999 (TeX Live 2019/dev/Debian) (preloaded format=xelatex)\\n \\\\write18 enabled.\\nentering extended mode\\nLaTeX2e <2018-12-01>\\n(/tmp/nasa-apt-pdf-service-7ycno4kt/tmp0klbhwyg.tex\\n(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls\\nDocument Class: article 2018/09/03 v1.4i Standard LaTeX document class\\n(/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo))\\n(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/l3packages/xparse/xparse.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3-code.tex)\\n(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def)))\\n(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/base/tuenc.def))\\n(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.cfg)))\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg)\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/xetex.def))\\n(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty\\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty\\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)\\n(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def)\\n(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg)\\n(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty))\\n(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hxetex.def\\n(/usr/share/texlive/texmf-dist/tex/latex/hyperref/puenc.def)\\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/stringenc.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))\\n(/usr/share/texlive/texmf-dist/tex/latex/booktabs/booktabs.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)))\\n(/usr/share/texlive/texmf-dist/tex/latex/float/float.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/setspace/setspace.sty)\\n(/usr/share/texlive/texmf-dist/tex/latex/lineno/lineno.sty) (./tmp0klbhwyg.aux)\\n(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty\\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))\\n(./tmp0klbhwyg.out) (./tmp0klbhwyg.out)\\n\\nLaTeX Warning: No \\\\author given.\\n\\n\\nLaTeX Font Warning: Font shape `TU/LatinModernMath(0)/bx/n' undefined\\n(Font)              using `TU/LatinModernMath(0)/m/n' instead on input line 115\\n.\\n\\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/se-ascii-print.def)\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 116--116\\n\\n\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 116--116\\n\\n\\nOverfull \\\\hbox (72.0pt too wide) in paragraph at lines 116--116\\n [][] \\n\\nLaTeX Warning: Citation `REFone' on page 1 undefined on input line 119.\\n\\n\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 119--120\\n\\n\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 119--120\\n\\n[1]\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 124--124\\n\\n\\nUnderfull \\\\hbox (badness 10000) in paragraph at lines 124--124\\n\\n[2] [3]\\nOverfull \\\\hbox (58.0pt too wide) in paragraph at lines 136--137\\n[] \\n\\nOverfull \\\\hbox (58.0pt too wide) in paragraph at lines 139--140\\n[] \\n[4]\\n! Undefined control sequence.\\nl.166 \\\\Discussion\\n                 \\n? \\n! Emergency stop.\\nl.166 \\\\Discussion\\n                 \\nOutput written on tmp0klbhwyg.pdf (4 pages).\\nTranscript written on tmp0klbhwyg.log.\\n\"}"
}

For the other ATBD, not even the normal PDF works.

Other

While adding the other ATBD fixtures I was confronted again with the image problem on local development:
https://github.com/developmentseed/nasa-apt/blob/d34bbcbe69fb7e41d89b00ec44919c4ddd915cf1/db/testData.sql#L13-L18
Any chance you can look into this?

@leothomas
Copy link
Collaborator Author

At first glance this seems to be a problem with the LaTex equation:
Where I remove this equation from the ATBD both the regular and journal versions are produced. I'll keep digging on this
image

@leothomas
Copy link
Collaborator Author

It's actually the macro \LaTeX that fails the PDF generation. The \LaTeX macro cannot be used in math mode.

One solution is to specifically watch out for this macro and try to escape it somehow. I'm concerned that this part of a larger problem due to the huge variety of possible user inputs, we will always be running into these kinds of errors

@leothomas
Copy link
Collaborator Author

leothomas commented Dec 8, 2020

@danielfdsilva I've fixed the Journal Discussion and Journal Acknowledgements sections and I've removed the \LaTeX macro that was breaking the equation processing in the Latex generation. PDF generation on the /journal/alias/ endpoint should be good to go for both ATBD's.

As for the local development image problem, I spent a good deal of time banging my head against this today. I've understood the root of the problem and I've reached out to more experienced team members for help finding a solution (I've tried everything I found on StackOverflow without success).

The root of the problem is:
The image file is stored in an S3 bucket managed by localstack. Localstack runs in a docker container called localstack. Localstack makes its resources available to the host machine (your laptop) at http://localhost:4566. However another docker container cannot access the localstack resources at localhost since each container's localhost points to itself. The pdf generation, which runs in a different container can access the s3 file, by using the localstack container's name (ie: http://localstack:4566 instead of http:/llocalhost:4566), but then the browser can't find the file since it does not have access to the container network (beyond the exposed ports).

This is why when the filename is stored under http://localhost:4566/bucket/filename.jpg it was accessible to the browser, but not the pdf generation script, and when it's stored under http://localstack:4566/bucket/filename.jpg it was accessible to the pdf generation script, but not your local browser.

Off the top of my head, the solution would be one of the following (in increasing order of hackyness):

  • Alias the localstack instance to localstack so that both the browser and the pdf generation container have access to the file at http://localstack:4566. (This seems feasible using the HOSTNAME_EXTERNAL property of localstack, but wasn't working for me for some reason).
  • Alias the localstack container's name to localhost . (localhost might be a reserved keyword, or this might break other things dependent on localhost)
  • Merge the pdf generation and the local stack images into a single container (this will give the pdf generation script access to file under http://localhost:4566/bucket/filename.jpg since the localstack is now running in the same container)
  • Include the front end within the docker-compose configuration as another container (this will give the front end access to the file under http://localstack:4566/bucket/filename.jpg) since it's now running under the same docker-compose

The good thing about this issue is that it only affects developer experience (since the pdf generation script has no problem loading files from external domains), however it's pretty important to be able to generate PDFs using local data, for testing and dev purpose.

I'll keep plugging away at this tomorrow.

@leothomas
Copy link
Collaborator Author

After a super helpful chat with @CiaranEvans , I tried wrapping the front end in a docker instance that can also connect to the network of the backend containers, which allowed the frontend container to download the file, however it still wouldn't load in the browser since the frontend container exposes a port to the browser and the browser attempts to the load the image.

I resorted to implemented a hot-replacement of the string localstack with localhost when the front end serves an image url (something similar is already happening in the backend cache).

Front end PR is open here

@leothomas
Copy link
Collaborator Author

leothomas commented Dec 11, 2020

Equation Wrapping:

Intelligent/graceful equation wrapping is very hard to achieve programmatically. In fact there's only one LaTeX package that attempts it (breqn) and reviews say it's still very experimental and not very stable.
Instead by using the \\ operator for line breaks and the & character as an anchor, user's can wrap their equation with \begin{aligned} ... \end{aligned} to produce a single equation item that will be printed over multiple lines. Eg:

\begin{aligned} \\ m_{12} (\{ \mathit{Red},\mathit{Blue} \})= K^\prime* [ &m_{1}(\{ \mathit{Red}, \mathit{Blue} \}) * m_{2} (\{    \mathit{Red}, \mathit{Blue} \}) \\ & + m_{1} (\{ \mathit{Red}, \mathit{Blue} \}) * m_{2} (\{ \mathit{Red}, \mathit{Blue}, \mathit{Green} \}) \\ & + m_{2} (\{ \mathit{Red}, \mathit{Blue} \}) * m_{1} (\{ \mathit{Red}, \mathit{Blue}, \mathit{Green} \})] \end{aligned}

produces the following equation

image

Note:

(The equation's LaTeX code above does overflow the WYSIWYG editor in the frontend app, which distorts the shape of the overall editor, that might be something to address)
image

(as opposed to:
image
without the long equation)

@danielfdsilva As long as we have documentation on how to use \\ and & as above, can we consider it the user's responsibility to write equations that don't overflow the page?

If so, the all the requirements for the journal PDF can be considered complete.

@danielfdsilva
Copy link
Collaborator

@leothomas Equation wrapping looks great and I'd say leaving this up to the user is ok.
I fixed the overflow on the frontend. Thanks for pointing it out.
image


Issues

There are a couple of problems with the tables:
This table rendered on the frontend
image

Is being rendered like so in both pdfs
image

  • Notice the NaN in what should be an empty header cell
  • The width of the table is larger than what looks like is the content width (compare table with text). Can something be done?
  • The caption is not showing up.

@leothomas
Copy link
Collaborator Author

  • Fixed table caption
  • Reduced table with to be within margins
  • Fixed NaN in table header
    image

@danielfdsilva danielfdsilva force-pushed the feature/journal-pdf-endpoint branch from 35bd642 to 58e7ca3 Compare December 16, 2020 22:34
@danielfdsilva danielfdsilva merged commit 47008d6 into develop Dec 17, 2020
@danielfdsilva danielfdsilva deleted the feature/journal-pdf-endpoint branch December 17, 2020 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants