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

UX improvements #192

Open
wants to merge 65 commits into
base: ux-improvements
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
84b2264
instantiation
quintfain Jan 20, 2022
569caf8
Test push
Cbarr-hub Jan 21, 2022
0f1dd92
Add LaTeX Menu
JadenMcElvey Jan 24, 2022
c2439e3
Added Toolbar Button to .TEX files
Cbarr-hub Feb 9, 2022
31e3fc4
Updated ReadMe for release notes 0.1.0
Cbarr-hub Feb 11, 2022
46359c5
Update README.md
Cbarr-hub Feb 11, 2022
d373ae0
Update README.md
Cbarr-hub Feb 11, 2022
0ff3118
Fixed merge conflict in README
Cbarr-hub Feb 11, 2022
22b9d4c
Added Preview Button functionality
Cbarr-hub Feb 11, 2022
aac4c36
Added sub and super buttons with functionality
Cbarr-hub Feb 13, 2022
2d85d8a
Fraction Button
quintfain Feb 14, 2022
2acb243
Correct golden ratio symbol
JadenMcElvey Feb 14, 2022
e36d24d
Merge branch 'development' of https://github.com/Cbarr-hub/jupyterlab…
JadenMcElvey Feb 14, 2022
416749f
Add table creation to LaTeX menu
JadenMcElvey Feb 14, 2022
e348211
Working fraction button
quint-fain Feb 16, 2022
9c7947b
Fixed comma delimiter for splitting fraction button inputs
Cbarr-hub Feb 16, 2022
deb241b
Updated Release notes 0.2.0
Cbarr-hub Feb 18, 2022
3a06cfb
Added drop down feature to ErrorPanel
ZX-80 Feb 19, 2022
2ee47cb
Added feature to filter errors for interesting output
ZX-80 Feb 19, 2022
e22f3ff
Merge branch 'equationbuttons' into development
Cbarr-hub Mar 4, 2022
5f40e3f
Fixed duplicate import for merge of EquationButtons into dev
Cbarr-hub Mar 4, 2022
ff6b83c
Merge branch 'SimplifiedErrors' into development
Cbarr-hub Mar 4, 2022
beda70d
Code for bullet point and numbered lists
quint-fain Mar 8, 2022
9b98df2
Added typeface toolbarButtons and functionallity
Cbarr-hub Mar 10, 2022
0c46c9e
Update README.md
ladyron Mar 11, 2022
5259ea4
Update README.md
ladyron Mar 14, 2022
56fd23c
Update .gitignore
ladyron Mar 17, 2022
aa5698d
Update .gitignore
ladyron Mar 17, 2022
908d797
Delete .DS_Store
ladyron Mar 17, 2022
d8b3ada
Merge branch 'typefaceModifiers' into development
Cbarr-hub Mar 30, 2022
e2f48b0
Fixed more merge errors
Cbarr-hub Mar 30, 2022
d11baaa
Added release notes for v0.4.0
ZX-80 Apr 1, 2022
e81bba9
Add Plot Button
JadenMcElvey Apr 2, 2022
3716399
Merge branch 'master' into development
ktaletsk Apr 13, 2022
a668976
Added table button to toolbar
Cbarr-hub Apr 15, 2022
98a8442
Moved changes from readme to docs/changelog
Cbarr-hub Apr 15, 2022
6ccbd33
Added icon svgs and implemented them on toolbar buttons
Cbarr-hub Apr 15, 2022
a9f48b7
Changed insert super and subscript logic
Cbarr-hub Apr 15, 2022
ea485e3
text alignment
darklordsep1 Apr 18, 2022
6abdeb7
text alignment example
darklordsep1 Apr 18, 2022
9e1f8c5
text alignment
darklordsep1 Apr 18, 2022
2c5324e
merge conflicts
darklordsep1 Apr 18, 2022
11b7f51
Add plot button
JadenMcElvey Apr 18, 2022
3b5b18a
Fix duplicate definitions of button behavior
Cbarr-hub Apr 20, 2022
ec4f9a2
Merged dev_revised into dev
Cbarr-hub Apr 20, 2022
ff446ee
Added icons to text alignment and cleaned up code
Cbarr-hub Apr 20, 2022
ee7f1e2
Add Plot Button
JadenMcElvey Apr 22, 2022
729b27c
Add Format Shortcuts
JadenMcElvey Apr 22, 2022
b226a1b
Adjusted formatting on readme
Cbarr-hub Apr 24, 2022
42d2237
Cleaned up checking if latex file and removed keybinds
Cbarr-hub Oct 27, 2022
e07f00f
merge upstream
ktaletsk May 28, 2023
b9b69a7
fix build issues
ktaletsk May 29, 2023
b0781be
remove package-lock
ktaletsk May 29, 2023
7b18ab8
remove yarn error log
ktaletsk May 29, 2023
423ec77
fix false diff
ktaletsk May 30, 2023
6d6d32c
fix false diff
ktaletsk May 30, 2023
e267056
fix false diff
ktaletsk May 30, 2023
c23cfe9
fix false diff
ktaletsk May 30, 2023
8536328
fix false diff
ktaletsk May 30, 2023
c002fb5
fix false diff
ktaletsk May 30, 2023
c65c738
fix false diff
ktaletsk May 30, 2023
c283356
fix false diff
ktaletsk May 30, 2023
200e3c4
fix false diff
ktaletsk May 30, 2023
68b6530
fix false diff
ktaletsk May 30, 2023
5c9a792
fix false diff
ktaletsk May 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog for `jupyterlab_latex`

- **4.1.0**:

- Added UI improvements to LaTeX Editor
- Preview Button
- Symbol and Constant Menu
- Filtered Error Messages
- Table Creation GUI
- Equation Buttons
- Typeface Modifier GUI
- Bullet point and Numbered List Buttons

- **3.2.0**:

- Minimum supported JupyterLab is 3.6.0
Expand Down
87 changes: 86 additions & 1 deletion jupyterlab_latex/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,91 @@ def bib_condition(self):
"""
return any([re.match(r'.*\.bib', x) for x in set(glob.glob("*"))])

def filter_output(self, latex_output):
"""Filters latex output for "interesting" messages

Parameters
----------
latex_output: string
This is the output of the executed latex command from,
run_command in run_latex.

returns:
A string representing the filtered output.

Notes
-----
- Based on the public domain perl script texfot v 1.43 written by
Karl Berry in 2014. It has no home page beyond the package on
CTAN: <https://ctan.org/pkg/texfot>.

"""
ignore = re.compile(r'''^(
LaTeX\ Warning:\ You\ have\ requested\ package
|LaTeX\ Font\ Warning:\ Some\ font\ shapes
|LaTeX\ Font\ Warning:\ Size\ substitutions
|Package\ auxhook\ Warning:\ Cannot\ patch
|Package\ caption\ Warning:\ Un(supported|known)\ document\ class
|Package\ fixltx2e\ Warning:\ fixltx2e\ is\ not\ required
|Package\ frenchb?\.ldf\ Warning:\ (Figures|The\ definition)
|Package\ layouts\ Warning:\ Layout\ scale
|\*\*\*\ Reloading\ Xunicode\ for\ encoding # spurious ***
|pdfTeX\ warning:.*inclusion:\ fou #nd PDF version ...
|pdfTeX\ warning:.*inclusion:\ mul #tiple pdfs with page group
|libpng\ warning:\ iCCP:\ Not\ recognizing
|!\ $
|This\ is
|No\ pages\ of\ output. # possibly not worth ignoring?
)''', re.VERBOSE)

next_line = re.compile(r'''^(
.*?:[0-9]+: # usual file:lineno: form
|! # usual ! form
|>\ [^<] # from \show..., but not "> <img.whatever"
|.*pdfTeX\ warning # pdftex complaints often cross lines
|LaTeX\ Font\ Warning:\ Font\ shape
|Package\ hyperref\ Warning:\ Token\ not\ allowed
|removed\ on\ input\ line # hyperref
|Runaway\ argument
)''', re.VERBOSE)

show = re.compile(r'''^(
Output\ written
|No\ pages\ of\ output
|\(.*end\ occurred\ inside\ a\ group
|(Und|Ov)erfull
|(LaTeX|Package|Class).*(Error|Warning)
|.*Citation.*undefined
|.*\ Error # as in \Url Error ->...
|Missing\ character: # good to show (need \tracinglostchars=1)
|\\endL.*problem # XeTeX?
|\*\*\*\s # *** from some packages or subprograms
|l\.[0-9]+ # line number marking
|all\ text\ was\ ignored\ after\ line
|.*Fatal\ error
|.*for\ symbol.*on\ input\ line
)''', re.VERBOSE)

print_next = False
filtered_output = []

for line in latex_output.split('\n'):
if print_next:
filtered_output.append(line)
print_next = False

elif ignore.match(line):
continue

elif next_line.match(line):
filtered_output.append(line)
print_next = True

elif show.match(line):
filtered_output.append(line)

return '\n'.join(filtered_output)


@gen.coroutine
def run_latex(self, command_sequence):
Expand Down Expand Up @@ -167,7 +252,7 @@ def run_latex(self, command_sequence):
self.set_status(500)
self.log.error((f'LaTeX command `{" ".join(cmd)}` '
f'errored with code: {code}'))
return output
return json.dumps({'fullMessage':output, 'errorOnlyMessage':self.filter_output(output)})

return "LaTeX compiled"

Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jupyterlab/latex",
"version": "4.0.0",
"version": "4.1.0",
"description": "JupyterLab extension for running LaTeX",
"keywords": [
"jupyter",
Expand Down Expand Up @@ -44,7 +44,6 @@
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"clean:labextension": "rimraf jupyterlab-latex/labextension",
"clean:all": "jlpm clean:lib && jlpm clean:labextension",
"precommit": "lint-staged",
"prettier": "prettier --write '**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}'",
"install:extension": "jlpm build",
"watch": "tsc -w"
Expand All @@ -66,6 +65,7 @@
"@jupyterlab/fileeditor": "^4.0.0",
"@jupyterlab/launcher": "^4.0.0",
"@jupyterlab/mainmenu": "^4.0.0",
"@jupyterlab/notebook": "^4.0.0",
"@jupyterlab/services": "^7.0.0",
"@jupyterlab/settingregistry": "^4.0.0",
"@jupyterlab/statedb": "^4.0.0",
Expand Down Expand Up @@ -122,5 +122,10 @@
},
"outputDir": "jupyterlab_latex/labextension"
},
"styleModule": "style/index.js"
"styleModule": "style/index.js",
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}
120 changes: 63 additions & 57 deletions sample.tex
Original file line number Diff line number Diff line change
@@ -1,57 +1,63 @@
\documentclass{article}
\usepackage{graphicx}

\begin{document}

\title{JupyterLab \LaTeX}
\date{}
\maketitle

\section{Introduction}
This is a sample document demonstrating the ability to live-edit
\LaTeX documents in JupyterLab.
\\
\\
Right-click on this document, and select "Show LaTeX Preview".
A new panel should open up on the right with the PDF that is generated
by this document. If there are any errors in the document, an
error panel should open below.
\\
\\
We can write equations:
\begin{equation}
\rho \left( \frac{\partial \mathbf{u}}{\partial t} + \mathbf{u} \cdot \nabla \mathbf{u} \right) =
-\nabla P + \eta \nabla^2 \mathbf{u} + \rho \mathbf{g}.
\label{eq:Navier–Stokes}
\end{equation}
\\
\\
And we can write tables:
\begin{center}
\begin{tabular}{ | l | c | r| }
\hline
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9 \\
\hline
\end{tabular}
\end{center}

We can reference equations by their numbers, i.e. Equation (\ref{eq:Navier–Stokes}).

\subsection{We can add new subsections}
And we can include images, such as the Jupyter logo:
\begin{center}
\includegraphics[width=0.65\textwidth]{images/jupyter_logo.png}
\end{center}



\pagebreak




You can also use SyncTeX by typing ⌘(CMD)/CTRL+⇧(SHIFT)+X.

\end{document}
\documentclass{article}
\usepackage{graphicx}

\begin{document}

\title{JupyterLab \LaTeX}
\date{}
\maketitle
test
$5_{3_{4} + 4_{3} + 5^{4}}$
\section{Introduction}
This is a sample document demonstrating the ability to live-edit
\LaTeX documents in JupyterLab.
\\
Right-click on this document, and select "Show LaTeX Preview".
A new panel should open up on the right with the PDF that is generated
by this document. If there are any errors in the document, an
error panel should open below.
\\
Test
\\
We can write equations:
\begin{equation}
\rho \left( \frac{\partial \mathbf{u}}{\partial t} + \mathbf{u} \cdot \nabla \mathbf{u} \right) =
-\nabla P + \eta \nabla^2 \mathbf{u} + \rho \mathbf{g}.
\label{eq:Navier–Stokes}
\end{equation}
\\
And we can write tables:
\begin{center}
\begin{tabular}{ | l | c | r| }
\hline
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9 \\
\hline
\end{tabular}
\end{center}


\centering{Right-click on this document, and select "Show LaTeX Preview". A new panel should open up on the right with the PDF that is generated by this document. If there are any errors in the document, an error panel should open below.}


We can reference equations by their numbers, i.e. Equation (\ref{eq:Navier–Stokes}).

Hello
We can reference equations by their numbers, i.e. Equation (\ref{eq:Navier–Stokes}).


\subsection{We can add new subsections}
And we can include images, such as the Jupyter logo:
\begin{center}
\includegraphics[width=0.65\textwidth]{images/jupyter_logo.png}
\end{center}



\pagebreak


You can also use SyncTeX by typing ⌘(CMD)/CTRL+⇧(SHIFT)+X.

\end{document}