svmiller / stevetemplates

My collection of R Markdown templates, as an R package.
http://svmiller.com/stevetemplates
128 stars 22 forks source link

Figure and table related bug in pdf-anon output file #15

Open martinmoland opened 2 years ago

martinmoland commented 2 years ago

Hi,

Thanks for great templates. I have gotten more and more used to the workflow from steveproj, but today I ran into an unexpected bug. When trying to add the "thanks" YAML parameter to the source file for the abstract (because most journals want me to have the acknowledgements and abstract on a separate page), something happened which replaced all in-text figures and tables in the pdf-anon output file with the output Table 1 (or 2, or 3) about here.

Is this a known bug, and do you have any indication what might be causing it? Very likely that I have screwed something up, but I have no idea what. Let me know if you need any sort of YAML or source code to test against your defaults.

svmiller commented 2 years ago

I re-ran my toy {steveproj} example and I think what you're describing is a design feature. Basically, by default, the pdf-anon output does that silly song and dance that journals love of placing the "FIGURE/TABLE N ABOUT HERE" placeholder into the text while the actual figure and table go to the back of the document. Now, if your tables and figures aren't appearing at all, that would be a bug---and assuredly a LaTeX issue---and I'd need to look into it further.

martinmoland commented 2 years ago

Thanks for the quick reply, there seems to be some variation of that happening: My figures appear as the first tables and figures in the appendix, which I have created directly in the Rmd file. This screws up the entire numbering of the appendix items, which I refer to throughout my text. That's definitely not optimal. Thus, is there any piece of code I can write in any of the src files that can override this default?

In addition, the code also seems to produce some sort of other oddity where it seems to input placeholders for all my appendix tables and figures in the appendix itself. This definitely feels like some weird LaTex behavior that I cannot figure out how to solve. If interested, I can compile my documents with a .tex and append it here.

Sorry for finding ever-more creative ways of messing up your hard work, and thanks for putting in the time on maintaining it.

svmiller commented 2 years ago

In my head, I designed {steveproj} to be one where the appendix is a separate document. Every journal submission site has their own peculiarities, but they're generally pickier about manuscript format than appendix format and reflexively want figures and tables at the back of the document. They also want "supplemental materials" as a separate document. That would explain some of the default design decisions in {steveproj}.

My recommendation, at least within the particular design that I have, would be to make a separate file called appendix.Rmd in your main project directory. You can get a basic skeleton of what such an .Rmd file would resemble here:

https://github.com/svmiller/peacesciencer/blob/master/manuscript/appendix.Rmd

(notice appendix: TRUE and appendixletter: "A").

You can see what the src/ directory would look like here:

https://github.com/svmiller/peacesciencer/tree/master/manuscript/src

Simple Makefile lines can be seen here:

https://github.com/svmiller/peacesciencer/blob/master/manuscript/Makefile

Now, I'm sure there is a solution if you wanted the appendix in the main manuscript itself and wanted it to be appropriately labeled/anonymized. However, I don't think it would play nicely with the endfloat package in LaTeX (which is doing the 'about here' placeholders). I'd have to think on this some more.