Hello, I just started using JupyterLab and I wanted to add som formating to my markdown. But when I add LaTeX code, it starts doing weird stuff, like changing a right parenthesis “)” to a big “D”. Adding/removing and/or moving period- and comma signs (other characters to, but not as often)…
I didn’t use anything advanced, just $\quad$ for indentation and a backslash for new line.
It doesn’t make this things while I am editing the cell, only after I run it. And when that have happened, it doesn’t help to remove the LaTex code and running the cell again, because the problem remains. One time it even made a part of the text bold, after removing the LaTeX code (previously there was no bold text in the cell).
It did successfully add this piece of code, without error’s in its own cell:
$p_sgV - p_agV - F_D = p_sVa.$
It is unfortunately not consistent. But here is one example. It is written in swedish, but that shouldn’t matter, because we use the same letters as in english (exept we have 3 additional ones (å, ä, ö) and they are not causing a problem in this example).
The lower part is the same cell, after I double clicked on it, to show what I typed.
$\quad$ Runt slutet av 1500-talet genomförde Galileo Galilei (1564-1642), en italiensk astronom och matematiker, långa studier av projektilers rörelse. Som en del av dessa studier, enligt den populära historien, tappade han föremål av olika vikt och storlekar från toppen av det lutande tornet i Pisa och observerade deras falltider.\
$\quad$ Galileo drog slutsatsen att ett fallande föremåls hastighet endast beror på fallavståndet, inte på dess storlek eller vikt. Han satte till vila, eller trodde att han gjorde det, den dåvarande uppfattningen att ju större och tyngre ett föremål är, desto snabbare faller det. Han hade delvis rätt, delvis fel.\
$\quad$ Samma år som Galileo dog föddes Isaac Newton (1643-1727). De berömda rörelselagarna för detta engelska geni rensade bort det mesta av förvirringen angående Galileos resultat. Hans andra lag var särskilt hjälpsam. Denna lag säger att summan av alla krafter som verkar på ett föremål är lika med föremålets massa gånger dess acceleration.\
$\quad$ För ett föremål som faller genom luften ger detta förhållande
Well, that was weird… I have tried to copy and past the code from this site and it always seem’s to turn out as expected. I then took the same text, from my original Notepad document (where I made my notes) and pasted it in the cell, below the one from this site (in the same Notebook) and I get the same error as I described and that is clearly seen in the picture.
Copying from this site and then pasting into a new Notepad document, and saving and then copying from the document and pasting to JupyterLab, does not produce the problem.
This is strange, because I have used Notepad as my exclusive note taking program for decades and there have never been a case, where any type of extra information (formating or otherweise) have been saved to or transfered from such a document. It should be plain text.
Is there some type of program or site, where you could paste the problematic code and see what type of extra information is being included?
Besides that. Like I said before, the errors only appear after introducing LaTeX, it doesn’t show up when I only use Markdown.
Do you mean Microsoft Notepad?
Anything made by Microsoft, except Visual Studio Code (VSCode), is traditionally notorious for adding things in. When learning to code usually it will be emphasized to use code writing software, i.e., a proper text editor, specifically for this reason.
And if you mean Notepad++, see here as how you can toggle that on. Most text editors for coding allow that sort of setting.
And have your tried to use a text editor? JupyterLab should let you open a text document and paste in stuff to check that way as it has its own text editor.
You can otherwise install and use a dedicated one, such as Sublime Text, Atom, or Notepad++. Visual Studio Code (VSCode) is actually now very popular and ruins the older adage of ‘Avoid anything with Microsoft in the name’ that is commonly repeated over and over to those learning to code. It however is more than just a text editor and is more of a full Interactive Development Environment (IDE).
Other online options, perhaps…
You can maybe use your text that causes issues now to screen online ones that are out there. StackEdit handles markdown so it may be more than you need. And of course there’s Jupyter accessible online, such as you can get from pressing the blue-green text that says ‘JupyterLab’ to the right of where it says ‘Open demo in a new tab’ at the top center of the page at the JupyterLite site. And as you’ve seen you can paste things in a text
You are missing the point.I am not talking about code. Do you see any code in my example (everything you see is markdown cells)? There will be Python code, but I intended to type it directly in other cells (code cells) in JupyteLab, that’s kind of the point of Jupyter Notebooks, to be able to mix code and text that explains the code (not the same thing as when you put comments in your code).
When it comes to editors, I have used all the well known ones, during my 25+ years of coding. But like I said, that have nothing to do with my notes. They are not code, only my explanation of the code.
And no. I have never seen Microsoft Notepad add anything to the text (We are not talking about Microsofts WordPad or Word (Part of Microsoft Office) They would have added information about the font, font size, if it is bold, italic etc. but Notepad doesn’t have that capability.). I have used it to remove information about styling, thousends of times (from copied text, from documents and websites) and it have never added anything of it’s own, only removed and made it plain text.
And the site didn’t show anything, just as it shouldn’t (the only thing it did was to change to a “formatting marks” view and I have already tried that in LibreOffice with the same piece of text). But thanks anyway.
Could it be some encoding issue during pasting from a specific Windows app? Could you try uploading a minimal notebook with the problematic markdown cell on https://gist.github.com/ (by drag-and-drop - a bit unintuitive, assuming you have a GitHub account) and sharing the gist?
Or could it be down to an issue with line endings encoding? Does the issue happen when more often depending on the number of lines (and e.g. does not happen at all when there is a single line?). Also, What exact jupyterlab version are you running?
I am not publishing on github or any other place.
Here is a Google Drive link:
As you can see in the example, the first line works, but the subsequent ones does not. That’s why it seems like a bug in JupyterLab/Anaconda. I don’t know why I decided to check the output of the paste from Notepad. I have never seen a problem with it before and I can’t find a fault now either…
I downloaded JupyterLab Desktop Version 4.0.7-1 and then updated to 4.0.8.But I see now that, 4.0.8 doesn’t start when I click the exe file in Windows. Anaconda shows 4.0.8 though.
Edit.
More mysterious things happening. I did just open JupyterLab to see, what version it was and it rapported 4.0.7-1. Then oppened Anaconda Navigator, and it showed 4.0.8.
I opened JupyterLab again after typing my reply, and now it shows 4.0.8…
Like I said before, the errors doesn’t show up the same every time. Downloading my own file, I can see that it somehow makes it look like I typed “acceleratio\n.” And i pasted (the original text have the backslash after the period sign) and double checked before uploading it. It seems like JupyterLab is changing the text when I Run the cell.
Edit.
Appearantly it also change the text when saving… Because I made another copy, got it to stick and then saved it. Before upploading it, I decided to open it again and this file, now all of a sudden, shows “acceleratio\n.” (With double backslashes. This site can’t show it, so I have to type it out or take screenshots). Even though it had the backslash in the right place (still with error in the output, as discussed).
So it is a Chrome problem then? Because like bh1428 said, it seems to work in FireFox. That’s a pitty because not only am I on my way to phasing out FireFox for Vivaldi (it’s Chromium-based), I prefer to use a standalone program (the Desktop version in this case), instead of runing applications in the browser.
It apepars that Chromium maintainers are not interested in changing the behaviour and instead recommend working it around, which is what we as JupyterLab community will need to do. I am happy to help with a review of a pull request if anyone is interested in working on this.
Note that markdown is not LaTeX. The rules for input are to found at https://spec.commonmark.org/
Though this often extend with mathjax support inside $…$ and […].
In particular, paragraphs in the input should just be separated by blank lines.
Runt slutet av 1500-talet genomförde Galileo Galilei (1564-1642), en italiensk astronom och matematiker, långa studier av projektilers rörelse. Som en del av dessa studier, enligt den populära historien, tappade han föremål av olika vikt och storlekar från toppen av det lutande tornet i Pisa och observerade deras falltider.
Galileo drog slutsatsen att ett fallande föremåls hastighet endast beror på fallavståndet, inte på dess storlek eller vikt. Han satte till vila, eller trodde att han gjorde det, den dåvarande uppfattningen att ju större och tyngre ett föremål är, desto snabbare faller det. Han hade delvis rätt, delvis fel.
Paragraph indenting should be controlled by your style sheet, rather than manual addition of spacing.