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

fix: inline latex math display in pdfs generated from ipynb #441

Merged
merged 2 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/layouts/application.pdf.erbtex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
\input|"python3 jupynotex.py #2 #1"
}

\usepackage[fencedCode,hashEnumerators]{markdown}
\usepackage[fencedCode,hashEnumerators,pipeTables,texMathDollars]{markdown}

\usepackage{luatextra}
\defaultfontfeatures{Ligatures=TeX}
Expand Down
5 changes: 5 additions & 0 deletions test/models/task_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'test_helper'
require 'pdf-reader'

#
# Contains tests for Task model objects - not accessed via API
Expand Down Expand Up @@ -357,6 +358,10 @@ def test_ipynb_to_pdf
assert File.exist? path
assert File.exist? task.final_pdf_path

# Test if latex math was rendered properly
reader = PDF::Reader.new(task.final_pdf_path)
assert reader.pages[3].text.include? "bmi = weigh2\n height"

td.destroy
assert_not File.exist? path
unit.destroy!
Expand Down
14 changes: 14 additions & 0 deletions test_files/submissions/vectorial_graph.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,20 @@
"source": [
"Testing a raw cell with $10 invalid latex code"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Testing inline latex math display"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Formula for calculating BMI: $\\text{bmi}=\\frac{\\text{weight}}{\\text{height}^2}$"
]
}
],
"metadata": {
Expand Down