Code Output in Random Locations in PDF Rendering of Quarto Document - pdf

I'm having the most frustrating time trying to have tables (which are code output) display where they should in a PDF rendered in Quarto. After a bog standard yaml, the source code underlying the image you can see below is
[begin]
Below is some ...
m(1976)
m(2016)
\newpage
[end]
Now, what's utterly bizarre is that
the two tables will not print one atop the other on the first page. It has nothing to do with how much space is left
the table "insists" on appearing below a footnote (!!)
the second table (not pictured, but the result of m(2016)) literally skips over the \newpage to appear on the following page.
Any help with this specific issue is appreciated as are general pointers in learning Quarto. Though their documentation is very professional, from a relative novice's perspective it's an absolute dog's breakfast. I'd liken it to trying to learn a foreign language through a dictionary.
Edit:
Here is the .qmd file needed to reproduce the heinousness.

Related

Figure placement in PDF with R markdown

There's a high likelihood this was asked and answered somewhere else, but I can't seem to find it.
The Problem
When I knit to a PDF, my tbl_summary object shows up nowhere near where I would like it. At first it showed up not only above the code chunk it was in, but above the graph from above that chunk!
I fixed that, but now its a solid page of blank space below where it should be.
What I've tried
Because of notes from here I've added this code in the beginning of the document:
I've also tried "extra_dependencies: ["float"] and I've also previously put this code in the first chunk in my document (not there now):
knitr::opts_chunk$set(fig.pos = "!H", out.extra = "")
Right now the relevant tbl_summary object that is showing up a page and half too low (preceded by blank space) is in this code chunk:
And I've tried it with and without the /newpage before it, and with and without the "fig.cap='Test', fig.pos='h'"
Any help would be appreciated! Even if its to simply point me towards where this has been previously asked.

Tabulator - formatting print and PDF output

I am a relatively new user of Tabulator so please forgive me if I am asking anything that, perhaps, should be obvious.
I have a Tabulator report that I am able to print and create as a PDF, but the report's formatting (as shown on the screen) is not used in either output.
For printing I have used printAsHtml and printStyled=true, but this doesn't produce a printout that matches what is on the screen. I have formatted number fields (with comma separators) and these are showing correctly, but the number columns should be right-aligned but all of the columns appear as left-aligned.
I am also using Tree View where the tree rows are coloured differently to the main table, but when I print the report with a tree open it colours the whole table with the tree colours and not just the tree.
For the PDF none of the Tabulator formatting is being used. I've looked for anything similar to the printStyled option, but I can't see anything. I've also looked at the autoTable option, but I am struggling to find what to use.
I want to format the print and PDF outputs so that they look as close to the screen representation as possible.
Is there anywhere I could look that would provide examples of how to achieve the above? The Tabulator documentation is very good, but the provided examples don't appear to explain what I am trying to do.
Perhaps there are there CSS classes that I am missing or even mis-using? I have tried including .tabulator-print-table in my CSS, but I am probably not using it correctly. I also couldn't find anything equivalent for producing PDFs. Some examples would help immensely.
Thank you in advance for any advice or assistance.
Formatting is deliberately not included in these, below i will outline why:
Downloaders
Downloaded files do not contain formatted data, only the raw data, this is because a lot of the formatters create visual elements (progress bar, star formatter etc) that cannot be replicated sensibly in downloaded files.
If you want to change the format of data in the download you will need to use an accessor, the accessorDownload option is the one you want to use in this case. The accessors transform the data as it is leaving the table.
For instance we could create an accessor that prepended "Mr " to the front of every name in a column:
var mrAccessor= function(value, data, type, params, column, row){
return "Mr " + value;
}
Assign it to a columns definition:
{title:"Name", field:"name", accessorDownload:mrAccessor}
Printing
Printing also does not include the formatters, this is because when you print a Tabulator table, the whole table is actually rebuilt as a standard HTML table, which allows the printer to work out how to layout everything across multiple pages with column headers etc. The downside of this is that it is only loosely styled like a Tabulator and so formatted contents generated inside Tabulator cells will likely break when added to a normal td element.
For this reason there is also a accessorPrint option that works in the same way as the download accessor but for printing.
If you want to use the same accessor for both occasions, you can assign the function once to the accessor option and it will be applied in both instances.
Checkout the Accessor Documentation for full details.

How can I change paper size when using Knit PDF in RStudio throughout a document?

I am looking for ways to change the paper size throughout a pdf document. I know that I can specify classotion: a3paper for the entire document in the yaml header. I also know that I can change margins with the geometry package (\newgeometry{· · ·} and \restoregeometry) throughout a document. Unfortunately, there is no option to change paper sizes, with the geomerty package, throughout a document though.
I would like to do something like this but with paper size instead.
Is it even possible?
I am asking because I have some wide tables in my document where letters and numbers overlap when having a(4|5|6)paper specified. Other tables are narrow and I would like to have them bigger.
My table output is not from kable or any other easily modifiable package outputs e.g xtable. So what I am saying is I can't modify the dimensions of my table in my code.
Any help is much appreciated. Thank you.
The geometry package knows about a3paper, so the following works for me
---
output: pdf_document
geometry: a3paper
---
test
producing a PDF with page size "841.89 x 1190.55 pts" (A4 would be "595.276 x 841.89 pts"). For readability you should use at least two columns for the text, though.

Extracting Data from an Area file

I am trying to extract information at a specific location (lat,lon) from different satellite images. These images are were given to me in the AREA format and I cooked up a simple jython script to extract temperature values like so.
While the script works, here is small snippet from it that prints out the data value at a point.
from edu.wisc.ssec.mcidas import AreaFile as af
url="adde://localhost/imagedata?&PORT=8113&COMPRESS=gzip&USER=idv&PROJ=0& VERSION=1&DEBUG=false&TRACE=0&GROUP=FL&DESCRIPTOR=8712C574&BAND=2&LATLON=29.7276 -85.0274 E&PLACE=ULEFT&SIZE=1 1&UNIT=TEMP&MAG=1 1&SPAC=4&NAV=X&AUX=YES&DOC=X&DAY=2012002 2012002&TIME=&POS=0&TRACK=0"
a=af(url);
value=a.getData();
print value
array([[I, [array([I, [array('i', [2826, 2833, 2841, 2853])])])
So what does this mean?
Please excuse me if the question seems trivial, while I am comfortable with python I am really new to dealing with scientific data.
Note
Here is a link to the entire script.
After asking around, I found out that the Area objects returns data in multiples of four. So the very first value is what I am looking for.
Grabbing the value is as simple as :
ar[0][0][0]

Controlling Doxygen's LaTeX output for making PDF documentation

I'm using Doxygen to generate documentation for my code. I need to make a PDF version of this and using Doxygen's LaTeX output appears to be the way to do it.
However I've run into a number of annoying problems, and not knowing anything about LaTeX previously haven't really got much of an idea on how to approach them, and the countless references for LaTeX related things are not much help...
I worked out how to create a custom style thing in a sty file and how to get Doxygen to use it. After a lot of searching I found out how to set the page margins etc. through this, and I'm guessing the perhaps this is the file I want for doing the other things I want, but I cant seem to find any commands for doign what I want :(
The table of contents at the start of the document contains a lot of items Id rather it didn't as it makes the contents very long. Is there some way to limit this contents to just say the first two levels, rather than having entries for every single individual function, variable, etc.? Id quite like to keep all the bookmarks however. I did try the "COMPACT_LATEX" option but as well as removing items on the contents pages, it removed the bookmarks and the member lists at the start of each section, which I do really want to keep.
Is there a way to change the order of things, like putting the full class description at the start of the section, rather than after all the members and attributes?
Wow, that's kind of evil of Doxygen.
Okay, to get around the tocdepth counter problem, add the following line to your .sty file:
\AtBeginDocument{\setcounter{tocdepth}{2}}% or whatever level you want
You can set the PDF bookmarks depth to a separate value:
% requires you \usepackage{hyperref} first
\hypersetup{
bookmarksdepth = section, % of whatever level you want
}
Also note that if you have a list of figures/tables, the tocdepth must be at least 2 for them to show up.
I don't see any way of rearranging those items within the LaTeX files---Doxygen just barfs them out there, so we can't do much. You'll have to poke around the Doxygen documentation to see if there's any way to specify the order I guess. (Here's hoping!)
You're so close.
Googling on "latex contents level" brought me to LaTeX - customizing the depth of the table of contents for different parts of the thesis which suggests
\setcounter{tocdepth}{n}
where n starts at zero for only the highest level division. This is presumable defined in all the default styles, but is worth a try in doxygen.
You could write a Perl/Awk script to simply delete the unwanted lines from the table of contents. For the file burble.tex, Latex will generate the file burble.toc, which will contain lines such as:
\contentsline {subsection}{Class F rewrites}{38}
\contentsline {subsection}{Class M rewrites}{39}
\contentsline {section}{\numberline {7}Definition and properties of the translation}{44}
\contentsline {paragraph}{Well-formedness}{54}
Simple regexes will identify which levels each line belongs to, and you can filter the file based on that. Once you have the table of contents the way you want it, insert \nofiles in the appropriate place (the style sheet?), which means that Latex will read the auxiliary files but not overwrite them.