latexify_py icon indicating copy to clipboard operation
latexify_py copied to clipboard

Fix brackets display

Open jianan1104 opened this issue 2 years ago • 9 comments

Overview

Fix brackets display, replace \left( to \mathopen{}\left( and \right) to \mathclose{}\right)

Details

Modify function def _wrap_operand in the src/latexify/function_codegen.py line by 422, Change the original brackets string to fix the display.

  • before image

  • after 截圖 2022-11-16 上午1 21 26

References

#90

jianan1104 avatar Nov 15 '22 17:11 jianan1104

@jianan1104 Thanks! You also need to fix all tests that are related to this change. Running ./checks.sh could check if the test passes or not.

odashi avatar Nov 15 '22 17:11 odashi

@jianan1104 Thanks! You also need to fix all tests that are related to this change. Running ./checks.sh could check if the test passes or not.

Thank you for reviewing. No problem. I'll fix it asap.

jianan1104 avatar Nov 15 '22 17:11 jianan1104

@odashi Hi, odashi. just fix and test the code, please check it.

jianan1104 avatar Nov 16 '22 06:11 jianan1104

It looks the CI accidentally passes though it detected some errors:

Run python -m pflake8 src
src/integration_tests/regression_test.py:91:89: E501 line too long ([11](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:12)4 > 88 characters)
src/integration_tests/regression_test.py:99:89: E501 line too long (115 > 88 characters)
src/integration_tests/regression_test.py:227:89: E501 line too long (132 > 88 characters)
src/latexify/__init__.py:7:1: E722 do not use bare 'except'
src/latexify/codegen/function_codegen_test.py:59:89: E501 line too long (107 > 88 characters)
src/latexify/codegen/function_codegen_test.py:75:89: E501 line too long (108 > 88 characters)
src/latexify/codegen/function_codegen_test.py:104:89: E501 line too long (107 > 88 characters)
src/latexify/codegen/function_codegen_test.py:[12](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:13)0:89: E501 line too long (108 > 88 characters)
src/latexify/codegen/function_codegen_test.py:[14](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:15)5:89: E501 line too long (103 > 88 characters)
src/latexify/codegen/function_codegen_test.py:149:89: E501 line too long (105 > 88 characters)
src/latexify/codegen/function_codegen_test.py:[15](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:16)3:89: E501 line too long (115 > 88 characters)
src/latexify/codegen/function_codegen_test.py:[17](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:18)7:89: E501 line too long (125 > 88 characters)
src/latexify/codegen/function_codegen_test.py:[19](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:20)4:89: E501 line too long (91 > 88 characters)
src/latexify/codegen/function_codegen_test.py:198:89: E501 line too long (109 > 88 characters)
src/latexify/codegen/function_codegen_test.py:[20](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:21)3:89: E501 line too long (93 > 88 characters)
src/latexify/codegen/function_codegen_test.py:[22](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:23)3:89: E501 line too long (119 > 88 characters)
src/latexify/codegen/function_codegen_test.py:2[28](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:29):89: E501 line too long (114 > 88 characters)
src/latexify/codegen/function_codegen_test.py:229:89: E501 line too long (111 > 88 characters)

odashi avatar Nov 16 '22 07:11 odashi

It looks the CI accidentally passes though it detected some errors:

Run python -m pflake8 src
src/integration_tests/regression_test.py:91:89: E501 line too long ([11](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:12)4 > 88 characters)
src/integration_tests/regression_test.py:99:89: E501 line too long (115 > 88 characters)
src/integration_tests/regression_test.py:227:89: E501 line too long (132 > 88 characters)
src/latexify/__init__.py:7:1: E722 do not use bare 'except'
src/latexify/codegen/function_codegen_test.py:59:89: E501 line too long (107 > 88 characters)
src/latexify/codegen/function_codegen_test.py:75:89: E501 line too long (108 > 88 characters)
src/latexify/codegen/function_codegen_test.py:104:89: E501 line too long (107 > 88 characters)
src/latexify/codegen/function_codegen_test.py:[12](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:13)0:89: E501 line too long (108 > 88 characters)
src/latexify/codegen/function_codegen_test.py:[14](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:15)5:89: E501 line too long (103 > 88 characters)
src/latexify/codegen/function_codegen_test.py:149:89: E501 line too long (105 > 88 characters)
src/latexify/codegen/function_codegen_test.py:[15](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:16)3:89: E501 line too long (115 > 88 characters)
src/latexify/codegen/function_codegen_test.py:[17](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:18)7:89: E501 line too long (125 > 88 characters)
src/latexify/codegen/function_codegen_test.py:[19](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:20)4:89: E501 line too long (91 > 88 characters)
src/latexify/codegen/function_codegen_test.py:198:89: E501 line too long (109 > 88 characters)
src/latexify/codegen/function_codegen_test.py:[20](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:21)3:89: E501 line too long (93 > 88 characters)
src/latexify/codegen/function_codegen_test.py:[22](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:23)3:89: E501 line too long (119 > 88 characters)
src/latexify/codegen/function_codegen_test.py:2[28](https://github.com/google/latexify_py/actions/runs/3476330689/jobs/5811657602#step:5:29):89: E501 line too long (114 > 88 characters)
src/latexify/codegen/function_codegen_test.py:229:89: E501 line too long (111 > 88 characters)

I do not know if any lint tool can fix automatically? or just edit line by line?

jianan1104 avatar Nov 16 '22 07:11 jianan1104

I do not know if any lint tool can fix automatically? or just edit line by line?

Length limit error is usually resolved by running Black, but I guess long string literals couldn't be handled correctly. So (unfortunately) some errors need to be fixed manually.

Btw, I also noticed that the list above contains some existing errors in main. I will fix it first ASAP.

It looks the accident around flake8 was reported recently: https://github.com/csachs/pyproject-flake8/issues/19

odashi avatar Nov 16 '22 07:11 odashi

@jianan1104 I fixed CIs. Could you merge the main into this pull request so that the flake8 errors kill the CI appropriately?

odashi avatar Nov 16 '22 08:11 odashi

@jianan1104 I fixed CIs. Could you merge the main into this pull request so that the flake8 errors kill the CI appropriately?

Sure. merged. wait for ci result...

jianan1104 avatar Nov 16 '22 11:11 jianan1104

I do not know if any lint tool can fix automatically? or just edit line by line?

Length limit error is usually resolved by running Black, but I guess long string literals couldn't be handled correctly. So (unfortunately) some errors need to be fixed manually.

Btw, I also noticed that the list above contains some existing errors in main. I will fix it first ASAP.

It looks the accident around flake8 was reported recently: csachs/pyproject-flake8#19

@odashi Done

jianan1104 avatar Nov 16 '22 11:11 jianan1104

Fixes #90

odashi avatar Nov 16 '22 22:11 odashi

Really great work, thanks!

Glad to be a contributor.

jianan1104 avatar Nov 17 '22 01:11 jianan1104