Markdown header with custom numbering in jupyter notebook - header

I would like to follow another documents numbering in my jupyter notebook.
e.g. I would like to start the first header at 3.2, the next 3.5 (because section 3.4 was not interesting) and so on.
# 3.2 section
# 3.5 section
So far, jupyter always starts at 1 and counts graclessly upward:
1.1 section
1.2 section
Can I hide that number?
Any ideas how to change this behaviour?

Related

Issues with figures when rendering rmarkdown/bookdown to pdf

In the last 3 days something has happened to RMarkdown. When rendering the default .rmd file produced by RStudio to a PDF file, the plot created has no margins beyond the plot axes and the axis scales and titles are not visible. When rendering to .html or Word format, the figures are as they should be. Today I reinstalled R and RStudio and updated all of the libraries (update.packages()) and the problem remains. This first cropped up in a bookdown project so I checked the .png files that bookdown produces and they all have the same problem - no axis scales or titles and the axis margins are at the figure limits.
Update: I un/reinstalled miktex and the pdf compiled correctly. When I removed MikTex and used tinytex instead, the axes were cutoff again. If I use MikTex instead of tinytex, every rmarkdown chunk generates an error that the MikTex database is locked by another program (no other apps were running so it much be something in the background) and results in a ~1-2 minute delay and a total compile times approach 45 minutes (before this problem it was ~5 minutes, still pretty slow). So it appears that there's an issue with tinytex and how it generates the .png files. I'm at a loss.
Any thoughts?
Current versions
R $version.string
[1] "R version 4.1.3 (2022-03-10)"
RStudio version
[1] ‘2022.2.1.461’
for me...
worked again after returning to earlier tinytex version
tinytex::install_tinytex(version = "2021.03")
tinytex::tlmgr("option repository https://ftp.tu-chemnitz.de/pub/tug/historic/systems/texlive/2020/tlnet-final")
for me, the PDF image files in figure_latex folder lacked axis/titles
happened shortly after I re-installed tinytex, even for the simplest code:
rmarkdown::render("test.Rmd",output_format='pdf_document')
in the jaml
output:
pdf_document:
keep_tex: true
plot(1:10,xlab='as 1',ylab='as 2')
html worked fine

Plot Viewer is not working anymore - how to fix?

I am currently working with VS Code and the Jupyter Extension. Until today the GUI of the Extension looked like this: old gui
But today this GUI changed to something like this: new gui
Problem is: If I now plot something I cannot open it in the Plot Viewer (before: double-clicking on the image would open it in a new file) but only save it in very low quality:
old version
vs.
new version
The 'Expand Image' Button is gone and now there is only a 'Save As' Button.
The GUI only changes to the newer version if I reopen the files. As long as a file is open in VS Code the old GUI remains and I can still open the images.
I already tried out to use older version of the Jupyter Extension, but it did not help.
If you need more in order to help, please write it and I will provide it.
The problem is probably very trivial but at this point, I am just very confused.
Thanks in advance and have a great day.
So I've found out that the Plot Viewer is no longer supported but will be added again soon.
Until then, if you want to use the Plot Viewer you need to do the following:
Install an older version of the Yupiter Extension (2021.2.0 worked for me).
this version does not work with the newest version of vs code
Install older Version of VS Code (https://code.visualstudio.com/updates/v1_57 worked for me).
After VS Code is installed you can open it and disable the auto update inside the VS Code settings.
Now you should be able to work with the old Jupyter Extension that includes the Plot Viewer.
If you update the Jupyter Extension you will need to do the above steps again.
Maybe this can help some lost souls searching for the old Plot Viewer.

Matplotlib data points, lines, fonts get bigger when using a Command (CMD) terminal

I created a GUI using PyQT Designer and inserted matplotlib figures. I developed the program in Anaconda / Spyder, and sized the graphs the way I wanted.
However, when run from a windows Command Prompt, or Anaconda Prompt (Anaconda 3), or Anaconda Powershell Prompt (Anaconda 3), using the command "python snappy.py", all the features in matplotlib get bigger....the data points are bigger, the lines including the axes are thicker, all the fonts are bigger. This makes the data more difficult to see, and wreaks havoc with the layout (labels get pushed off the canvas). Spyder and Anaconda prompt are run on the same computer, using the same installation of Anaconda.
matplotlib Comparison
What causes the difference, and can I control what "size" or "resolution" my matplotlib figures are.
I "figured" this out (pardon the pun). I added this to the top of my code.
plt.rcParams['figure.dpi'] = 60
The default resolution is normally 100. When I hard-coded it to 100 in my script, it replicated the "fat" lines and "large" fonts that I was seeing when running from the command prompt. When I lowered this value in my code to about 70 it matched what I had previously seen in Spyder.
So the default resolution of matplotlib running in my Spyder installation is different somehow.

How to increase the font size/ better render Pandas dataframes in Jupyter Notebooks opened in VS Code?

Is there a way to change how Pandas dataframes are rendered in output cells of Jupyter Notebooks opened in VS Code? By default, the font of the dataframe output is small, regardless of my VS code settings (see 1). In addition, I'd like for the dateframes to render more like the default rendering in native Jupyter notebook opened in a browser (see 2). Does anyone know how to make VS code change the dataframe rendering. Is there something I need to change in settings?
Notebook in VS Code:
Notebook in Chrome:
Edit: Using print(df) only increases the font size to match my font settings, but doesn't change the appearance.
Maybe these two new settings in vscode v1.67 will help:
notebook.outputFontSize, "Font size for plain text outputs. When set to 0 #editor.fontSize# is used."
notebook.outputFontFamily, "The font family for plain text output of notebook cells. When set to empty, the #editor.fontFamily# is used."
from https://github.com/microsoft/vscode/pull/147321/commits/51ab78f535d8537e031e1ae77cac678ae22b0249

wkhtmltopdf and chinese characters

Trying to generate a PDF with wkhtmltopdf but it gives me a lot of trouble displaying all the characters.
Some of characters work - e.g. when printing
"Invoice No (付款编号)" Chinese character no 1, 2 and 4 are correctly printed but character no 3 just displays an empty space in the PDF.
"Customer no (客户编号)" Chinese character no 1 and 4 are correctly displayed but character no 2 and 3 aren't displayed in the PDF.
"Total (总额)" none of the Chinese characters are displayed in the generated PDF.
I'm on a Ubuntu 14.04 desktop system with wkhtmltopdf version "wkhtmltopdf 0.12.1 (with patched qt)". I have installed the Chinese fonts and all the characters are correctly displayed in both gedit and Firefox on my system, but wkhtmltopdf only displayes about 75% of them.
My HTML document is made in with UTF-8 character set and is correctly displayed in Firefox and gedit. I have also tried to embed the font-face directly in the style section of the header using the src: url(data:font/ttf;base64,AAEA....) tag and wkhtmltopdf changes the font face as expected but the missing characters are still missing.
Any help is really really appreciated as I'm getting out of ideas.
Did you install the Chinese, Japanese, and Korean Fonts that are mentioned in the Ubuntu Community Help Wiki?
Looking at the PDF generated on another System in detail, you can find out which font is used by wkhtmltopdf on that system and then locate the proper substitute.
Dalibror Nasevic did the work for a large subset of asian fonts and described what he had to install on a CentOS (RedHat) based system:
Figuring out missing fonts for wkHTMLtoPDF
On a headless Debian-stretch-based system, according to Dalibror Nasevic I had to add
fonts-droid-fallback,
fonts-wqy-microhei and fonts-wqy-zenhei
In addition, following the recommendations from the Ubuntu Community Help Wiki, fonts-dejima-mincho, fonts-nanum-coding, fonts-takao, fonts-takao-gothic, fonts-takao-mincho might be worth giving a try.