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 printing in IJuliaMode #2447

Merged
merged 2 commits into from
Feb 13, 2021
Merged

Fix printing in IJuliaMode #2447

merged 2 commits into from
Feb 13, 2021

Conversation

odow
Copy link
Member

@odow odow commented Feb 2, 2021

A few printing changes that were needed to fix the printing issues in the tutorials: #2444 (comment)

Fixes some of the points in #2446

  • IJulia strings now created as a single line without \n. Makes no difference to latex, but Documenter struggled to print these.
  • \\begin{alignat*}{1} becomes \\begin{aligned}
  • x binary becomes x ∈ {0, 1}
  • x integer becomes x ∈ Z
  • Sets without a nice fallback are printed in \text{} instead of math.
  • Constraints, by themselves, without names, are printed as display equations instead of in-line.

I'll post before/after screenshots from IJulia in a bit.

Before

image

After

image

@codecov
Copy link

codecov bot commented Feb 2, 2021

Codecov Report

Merging #2447 (a428911) into master (2892b68) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2447      +/-   ##
==========================================
+ Coverage   92.25%   92.26%   +0.01%     
==========================================
  Files          43       43              
  Lines        4634     4642       +8     
==========================================
+ Hits         4275     4283       +8     
  Misses        359      359              
Impacted Files Coverage Δ
src/print.jl 91.56% <100.00%> (+0.21%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2892b68...7b946d7. Read the comment docs.

@@ -201,7 +201,7 @@ end
function model_string(print_mode, model::AbstractModel)
ijl = print_mode == IJuliaMode
sep = ijl ? " & " : " "
eol = ijl ? "\\\\\n" : "\n"
eol = ijl ? "\\\\" : "\n"
Copy link
Member

Choose a reason for hiding this comment

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

Is this due to a bug in Documenter that is reported somewhere or a known limitation ?

Copy link
Member Author

Choose a reason for hiding this comment

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

It was the same error as this: JuliaDocs/Documenter.jl#1387.

Looking through your PR, I guess the regex needs a suffix "s so it can match multiline strings:
https://github.com/JuliaDocs/Documenter.jl/pull/1426/files#diff-c34d581afcb6837fd39a6b0b0428090c049d7dad13de417d96dc08a0ed01cf70R1751-R1752

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

So the newline issue can be fixed upstream, but there is still the issue that we are using alignat instead of aligned. With this PR, the tutorials print nicely.

src/print.jl Show resolved Hide resolved
src/print.jl Show resolved Hide resolved
@odow odow changed the title WIP: fix printing in IJuliaMode Fix printing in IJuliaMode Feb 4, 2021
@odow odow added the Category: Printing Related to printing label Feb 4, 2021
@odow odow requested a review from blegat February 11, 2021 20:51
@blegat blegat mentioned this pull request Feb 12, 2021
@odow odow merged commit ced0fe8 into master Feb 13, 2021
@odow odow deleted the od/print branch February 13, 2021 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Printing Related to printing
Development

Successfully merging this pull request may close these issues.

2 participants