In the middle of the desert you can say anything you want
TL;DR \newpage~\newpage~\newpage~\newpage
for 3 empty pages
\newpage
doesn’t always work for well me in, esp. not in the IEEE and LREC templates. Either only one column is cleared, or there are issues with images/tables/… positions.
\clearpage
works for me in all cases I’ve tried.
EDIT: but only one page, not multiple! For multiple empty pages one after the other this1 does the trick:
\newpage
~\newpage
ChatGPT thinks it works because ~
being a non-breaking space makes LaTex try to add both empty pages on the same page, leading to two empty pages. Somehow allowing a newline between new pages makes it interpret both pages as the same command, since it’s already a new page.
When saving seaborn images there was weirdness going on, with borders either cutting labels or benig too big.
Solution:
# bad: cut corners
ax.figure.savefig("inat_pnet_lorenz.png")
# good: no cut corners and OK bounding box
ax.figure.savefig("inat_pnet_lorenz.png", bbox_inches="tight")
EDIT 2023-12-14
Paper reviewer suggested exporting in PDF, which led me to graphics - Good quality images in pdflatex - TeX - LaTeX Stack Exchange:
Both gnuplot and matplotlib can export to vector graphics; file formats for vector graphics are e.g. eps or pdf or svg (there are many more). As you are using pdfLaTeX, you should choose pdf as output format, because it will be easy to include in your document using the graphicx package and the \includegraphics{} command.
Awesome! So I can save to PDF and then include using the usual code (edit - eps works as well). Wow!
Static image export in Python:
fig.write_image("images/fig1.png")
PDF works as-is as well, EPS needs the poppler library but then works the same way
For excessive margins in the output PDFs:]
fig.update_layout( margin=dict(l=20, r=20, t=20, b=20), )
When including a PDF plot, I get this sometimes:
This is a problem only when viewing the PDF inside qutebrowser/Overleaf, in a normal PDF viewer it’s fine!
Didn’t find this in the documentation, but:
gg = ds.groupby(by=["species"])
lg = next(gg.groups)
# lg is the group name tuple (in this case of one string)
group_df = gg.get_group(lg)
Looking for a way to have vertical/tree tabs, I found a mention of the zotero web version being really good.
Then you can have multiple papers open (with all annotations etc.) in different browser tabs that can be easily navigated using whatever standard thing one uses.
You can read annotations but not edit them. Quite useful nonetheless!
PDF reader feature request: open the same pdf twice in split screen - Zotero Forums: View -> Split Horizontally/Vertically!
It’s especially nice for looking at citations in parallel to the text.
EDIT 2023-12-05 Overleaf has Vim bindings! Enable-able in the project menu. There are unofficially supported ways to even make custom bindings through TamperMonkey
<C-b/i>
. Same for copypaste etc.<C-/>
for adding %
-style LaTex comments.<C-S-c>
for adding Overleaf commentsOverleaf Keyboard Shortcuts - Overleaf, Online LaTeX Editor helpfully links to a PDF, screenshots here:
It seems to have cool multi-cursor functionality that might be worth learning sometime.
Overleaf has a lot of templates: Templates - Journals, CVs, Presentations, Reports and More - Overleaf, Online LaTeX Editor
If your conference’s is missing but it sends you a .zip, you can literally import it as-is in Overleaf, without even unpacking. Then you can “copy” it to somewhere else and start writing your paper.
0paper.tex
makes it appear on top, easier to find.Difference between %time and %%time in Jupyter Notebook - Stack Overflow
%time
refers to the line after it, %%time
refers to the entire cellTIL that for readability, x = 100000000
can be written as x = 100_000_000
etc.! Works for all kinds of numbers - ints, floats, hex etc.!1
I have a larger-than-usual text-based dataset, need to do analysis, pandas is slow (hell, even wc -l
takes 50 seconds…)
Vaex: Pandas but 1000x faster - KDnuggets - that’s a way to catch one’s attention.
I/O Kung-Fu: get your data in and out of Vaex — vaex 4.16.0 documentation
vx.from_csv()
reads a CSV in memory, kwargs get passed to pandas’ read_csv()
vx.open()
reads stuff lazily, but I can’t find a way to tell it that my .txt
file is a CSV, and more critically - how to pass params like sep
etc
vx.from_ascii()
has a parameter called sepe rator?! API documentation for vaex library — vaex 4.16.0 documentationconvert=
that converts stuff to things like HDFS, optionally chunk_size=
is the chunk size in lines. It’ll create $N/chunk_size$ chunks and concat together at the end.nrows=
is the number of rows to read, works with convert etc.usecols=
limits to columns by name, id or callable, speeds up stuff too and by a lotdf.export_hdf5()
in vaex, but pandas can’t read that. It may be related to the opposite problem - vaex can’t open pandas HDF5 files directly, because one saves them as rows, other as columns. (See FAQ)object
, in my case it was a boolean. Objects are not supported1, and booleans are objects. Not trivial situation because converting that to, say, int, would have meant reading the entire file - which is just what I don’t want to do, I want to convert to hdf to make it manageable.Syntax is similar to pandas, but the documentation is somehow .. can’t put my finger on it, but I don’t enjoy it somehow.
l_desc = df.describe()
# We find column names that have length_of_dataset NA values
not_empty_cols = list(l_desc.T[l_desc.T.NA!=df.count()].T.columns)
# Filter the description by them
interesting_desc = l_desc[not_empty_cols]
Use Virtual Environments Inside Jupyter Notebooks & Jupter Lab [Best Practices]
Create and activate it as usual, then:
python -m ipykernel install --user --name=myenv