u/True_Tea3001

Is it possible to load a PDF asynchronously using QtPDF?

I'm trying to load a PDF in a Qt Widget application using threading. Irrespective of what I do, it fails to load the PDF. I tried creating a concurrent thread, made a new QPdfDocument, loaded a PDF into the entity and then moved it to the main thread before returning the pointer. It still doesn't work! Here is an MWE (I know that the PDF loading in this example is synchronous, but even this fails to work - forget about loading the PDF asynchronously):

  QFuture<QPdfDocument*> future = QtConcurrent::run([](){
    QPdfDocument* loadDoc = new QPdfDocument();
    loadDoc->load(ProjectSettings::instance().pdfPath);
    loadDoc->moveToThread(QApplication::instance()->thread());
    return loadDoc;
  });

  m_document = future.result();
reddit.com
u/True_Tea3001 — 2 days ago
▲ 497 r/LaTeX

My LaTeX style with a LOT of custom user options! Thoughts?

Huge update to the sty file: I've added a black and white variant of the sty file which can be activated by using the user option boxbw. For more details, check the end of the post.

This is my current LaTeX (yep, gotta get this correct) style. It comes with a lot of custom configurable options which allow changing the styling of the document on the fly! All you have to do is pass the option as a parameter while loading the sty file as \usepackage[<params>]{bubu} for using them. Currently, you can use the following user options:

  • fancycover -- use the fancy design in the cover page
  • min* -- uses a very minimal styling for a blazing fast compilation
  • boxbw -- strips off colors from ALL tcolorboxes leaving behind an elegant B/W template.
  • nohdr -- removes the header (as you can see in the images above)
  • noauthor -- excludes the author name from the header
  • nodate -- excludes the data from the header
  • notitle -- excludes the title from the header
  • sectionmark -- uses section name in the title instead of the document title
  • nosecthm -- continues the same counter throughout the document (explained below)
  • nocountcont -- maintains a distinct counter for different types of boxes (explained below)
  • cs -- includes minted and its associated setup
  • epi -- includes epigraph and its associated setup (the quote you see on the cover page)
  • bib -- sets up bibliography
  • hints -- sets up the hint system (scrambledenvs)
  • noasy -- removes asymptote from the package list
  • bon -- sets up my problem database management system :)
  • nosecthm: Suppose you want the theorem counters to start from 1 and increase in a linear fashion, i.e., Theorem. 1, Lemma 2., Claim 3., and so on, irrespective of the section they are in, then you can use this option.
  • nocountcont: Suppose you want to keep the numbering of theorem and lemma separate, i.e., Theorem 1.1., Theorem 1.2., and then Lemma 1.3., then you can use this option.

The min option makes the compilation almost instantaneous by stripping down all the design :). Super useful for editing files that go into my problem database, BON. Well, that's for another post. :D

You can find my sty file on my dotfiles repository. I've also added a LaTeX template so that you get to know the available commands, macros, and boxes and can leverage the full potential of this sty file.

This style is heavily inspired by Evan Chen's sty file and sohamcho8's sty file (you might've seen this before in Senior Mars's sty file). The cover page design is inspired (more like copied, welp) from Dylan Yu's sty file.

---

EDIT:

I've decoupled the color settings by replacing every hard-coded color with variables. Now anyone can make a new color theme with the help of a little googling, asking LLMs, and trial and error. The color setup now has its own independent section which starts from line 123 in my sty file.

I've also added a new user option called boxbw which converts ALL the boxes to their black and white variants (you can customize which gradient of black you want particularly, by editing the value in color setup). Here is a document showcasing the new BW mode: BW boxes PDF.

u/True_Tea3001 — 18 days ago