Rmarkdown PDF in line citations not rendering correctly - emacs

I am working with EMACS/Zotero/rmarkdown. Zotero is linked to EMACS with zotxt.
The in line citations are not following the .csl format correctly. For example, using the American Psychological Association 7th edition (apa.csl) format, in line citations should be in as follow:
(R Core Team, 2022)
But I am getting:
R Core Team (2022)
MRE is:
---
title: "literature review"
author: "Me"
date: "06/22/2022"
output: pdf_document
bibliography: references.json
csl: apa.csl
---
## Test text
This is just a test #rcoreteam2022. That citation should appear as
"(R Core Team, 2022)", but it does not.
## References
Pdf screenshot
The pdf is rendered with:
render("mre.rmd", "pdf_document")
The .csl should be correct, I exported it out of Zotero and the Zotero preview gives the correct format.

After a bunch of searching, I figured it out. I found this blog post helpful:
https://plantarum.ca/2020/07/20/blogdown-citations/
Basically, my citation keys need to be in brackets, so instead of:
This is just a test #rcoreteam2022.
I need to use:
This is just a test [#rcoreteam2022].
And for multiple citations:
This is just a test [#rcoreteam2022; #Smith_2002].

Related

Generate .hhk file From Word Document

I am trying to convert MS Word file to chm file. I have a well organized word document. But,I could not figure out how to word saved as a html file to chm file. I know I can add html file to created project but there are some issue such that I could not solve how to convert ms word table of content file to index file in html help workshop program. I would be very happy If someone provide some example about conversion of word documents.(I am trying to achieve this thorough HTML Help Workshop program)
Best regards,
Converting a Word document to CHM format is difficult without special (often expensive) tools and has a learning curve.
You should think about whether the PDF format is not sufficient. But the CHM format - integrated in the Windows operating system - has of course some popular functions.
I recommend to read through Search and Index not working after converting from Word 2016 to CHM.
As I mentioned in my answer I never used chmProcessor before (because using other tools) but surprisingly seems to be a good one for converting Word documents in a simple way.
Please try chmProcessor for your needs. You may want to ask a new question here on SO later.
Edit:
Maybe you have additional interest in the following CodeProject article:
How to Easily Write a User's Guide for Your Application using Different File Extensions

YAML header of markdown file generates odd table on top of document

I get a weird output from my YAML header which I do not intend.
Instead I expect the normal output with title, author and the table of contents of course.
The following code produces the following output:
---
title: General Stuff
author: Me
output:
html_document:
toc: true # table of content true
toc_depth: 3 # upto three depths of headings (specified by #, ## and ###)
number_sections: true ## if you want number sections at each table header
theme: united
---
generates this output:
I got this output from GitHub where the file is displayed. Maybe the issue is that GitHub uses some interesting markdown version...?
Maybe the issue is that GitHub uses some interesting markdown version...?
YAML frontmatter isn't part of Markdown itself. A regular Markdown processor wouldn't do anything special with it. It would probably render a <hr> and some text, maybe ending with a header.
But yes, GitHub treats YAML front matter specially:
Many blogging websites, like Jekyll with GitHub Pages, depend on
some YAML-formatted metadata at the beginning of your post. You know, the stuff that goes between dashes like this:
---
title: Blogging Like a Boss
---
Starting [September 27, 2013], we’ll render this metadata within GitHub as an
horizontal table, for easier reading

Bookdown chapter bibliographies .csl file MSWord/PDF

My desired output is both an (1) MSWord and (2) PDF document, both with (a) in-text citations, (b) citations in some footnotes/endnotes, (c) chapter bibliographies, and (d) cumulative bibliography, (a)-(d) according to the .csl file, Springer - Humanities (author-date).
My tools are: .Rmd files, bookdown, LibreOffice, Zotero.
My problem:
IF(MSWord output) {NO chapter bibliographies}
IF(PDF output AND chapter bibliographies) {citation_package: natbib OR citation_package: biblatex}
IF(PDF output AND .csl file) {citation_package: none}
I hope to avoid breaking the book into separate bookdown projects for each chapter---this is annoying manual work and some chapters build R objects that are used in subsequent chapters (so it would be required rewriting code and caching things, etc.).
Attempted solutions:
I have successfully implemented both the biblatex and the natbib solutions to "bookdown + chapter bibliographies + PDF" here, but that solves one part of my problem: Is there a way to add chapter bibliographies using bookdown?
I have successfully implemented the solution to "bookdown + .csl file + PDF" here, but that solves one part of my problem: use csl-file for pdf-output in bookdown
Notes
The PDF output will be considered a reference document, thus solving the MSWord document problem is the priority (which may involve manually copying and pasting from the PDF output).
Technically, I'm also using the documentclass: svmono (where author/svmono.cls is here: Springer LaTeX2e macro packages for monographs and no "Humanities" .bst file is offered)

Prevent Word 2010 from saving o:gfxdata base64 or uuencoded VML?

I am working with .docx files containing several drawing canvases with images inserted and some lines and arrows drawn in Word 2010. I am using 2010 format with no compatibility mode.
Word inserts an o:gfxdata attribute into each v:shape and v:group element and fills it with ascii encoded something. From what I have read it may be a copy of the VML describing the v:shape or v:group. I don't know if I just don't know what to look for, but I cannot determine what this data is for as its removal has no apparent effect on my ability to read or edit the document in Word 2003, 2007, or 2010.
It does swell the document.xml to almost twice the (apparent) necessary size. This considerably slows OpenTBS' processing so I would like to remove it, if possible. Does anyone know of a way to tell Word 2010 to quit saving this extra data? Or what it is for? I have really struggled to find any documentation on it beyond this post.
Edit:
Here is a sample .docx. The document.xml is ~141KB and OpenTBS takes an average of 10.35 seconds to create a file that includes this as a subtemplate 21 times. If I remove all of the o:ogfxdata attributes, the file size is reduced to ~37KB and OpenTBS takes only 2.99 seconds to produce the same file.
Edit 2:
After further investigation, it appears the removal of the o:gfxdata may cause Word 2003 with an older Compatibilty Pack installed, to object to the file with the following error:
"This is a pre-release version of the Compatibility Pack and can open
pre-release Office 2007 files only. Do you want to check for a newer
version of the Compatibility Pack?"
I have been able to open the file by installing a newer compatibility pack - though it prompts the user about the incompatibility and converts the file in order to open it. This does not damage my file, but it is something to look out for.
Attribute o:ogfxdata is poorly documented in the web.
According to your investigations, it's some kind of compatibility extra information.
You can delete those attributes in your template using OpenTBS.
The cleaning can be done once on your template without any merging, and then save the cleaned template as a new template. Or you can perform the cleaning each time you open the template.
Cleaning the DOCX file:
while ($x = clsTbsXmlLoc::FindStartTagHavingAtt($TBS->Source, 'o:gfxdata', 0) ) {
$x->ReplaceAtt('o:gfxdata', '');
$TBS->Source = str_replace(' o:gfxdata=""', '', $TBS->Source);
}
Note that the class clsTbsXmlLoc is provided with OpenTBS and is undocumented.
The code should work since OpenTBS 1.8.0. (which is currently in stable beta version).
I've noticed that since attributes o:gfxdata are deleted, they do not come back immediately when you edit the docx.

How to use SyncTeX with Org-mode?

Background
With SyncTeX you can get forward and backward search between a source document and the typeset material. More specifically:
Forward search is to jump from a particular place in the source document, e.g. a LaTeX file, to the corresponding place in the typeset material, e.g. a PDF file.
Backward search is to jump from a particular place in the typeset material, e.g. a PDF file, to the corresponding place in the source document, e.g. a LaTeX file.
With Org-mode you can export as LaTeX and process it to PDF.
Question
It would be useful to be able to do forward and backward search between an Org-mode file and the PDF it produces on LaTeX export. Is this possible?
As mentioned, SyncTeX already implements forward and backward search between a LaTeX file and its resulting file. So the missing link seems to be the jump between the Org-mode file and the LaTeX file it is exported as.
I found a similar question on the mailing list: [Orgmode] synctex!! ...syncorg? It got no answer involving a solution.
There is a recent (April 2013) thread on the org-mode mailing list which has some preliminary patches. However, reading the emails, it seems like it's a tricky problem.
There is a more recent (depending on your frame of reference) post from October 2013 which has a solution. However, I have not been successful with that code, and re-raised the issue in this thread.