How to disable DOI/URL for bibtex in Rmarkdown - r-markdown

I am using better bibtex and zotero to generate references in rmarkdown.
It works very good except that journal articles and books have an url/doi associated.
My adviser is not too happy about it and I could not figure out how to disable the url/doi in the rmarkdown config or elsewhere.

What I know is that you have to edit your *.csl file (asa.csl, apa.csl or something you use). You could accomplish this very easy by uploading it to this online csl editor. Browse to bibliography/layout/access(macro)/Group/conditional/ and look if there is an URL entry. I got rid of the DOI by setting an option there that the variable should be 'url' AND the document type 'webpage'. Then download the new *csl file, save it to your prefered directory and just knit it. (Look also here with pictures).
Note: Please make rather a safety copy before messing around with your *csl.

Related

Adding preamble.tex and/or modifying css

Thanks for making papaja. It's really terrific!
I just submitted my first journal article using it and ran into problems. The layout staff don't know what to do with the code chunks and listings that are fine in single-column, full page format, but not in their 2-column format. I'm trying use the class 'jou' option to make 2 columns, but I can't figure out how to control the size of code and listing fonts (possibly by modifying the css, as recommended here), or how to using the latex package 'listings' to set listings to wrap (as recommended here).
I'd be grateful for any advice, and my apologies if I've missed how one might do this in the documentation.
If it's only about getting the listings package to work, you can modify the YAML header that it looks similar to the following:
documentclass : "apa6"
classoption : "jou"
output :
papaja::apa6_pdf:
pandoc_args: --listings
header-includes:
- \lstset{breaklines=true}
However, note that using automatic line breaks will most likely break the code at some points. Therefore, it is worthwhile to consider alternatives: For instance, you could try to use a code style that uses more line breaks. The styler package and add-in might be helpful accomplishing this: https://styler.r-lib.org/

"Edit this page" or "View source option" for Jekyll blog post

For my jekyll blog, I'm knitting Rmd to Md for the posts. At somewhere (preferably top), I want to programmatically add a link to view the source page (Rmd) hosted under _sources folder in top level directory.
Similar implementation can be found at https://yihui.org/en/about/ (at the left sidebar- Edit this page option)
Can this be done by some modification in custom knit command?
OR
Some html-include with liquid syntax should be used?
What about this? This has the Github icon, and links to the repo on the github page. Without any reprex, or an example from you, this is the best I can do unless you give more details. Does Jekyll use YAML?
I got this working, so answering my own question
Well in Rmarkdown, we can access the current source file as knitr::current_input().
This can be combined with the url of repository to get the full link to the source file. The best way is to create a new YAML entry as
RmdSource: '_source/`r knitr::current_input()`'
Now to programmatically add the link, either we can use R code with some liquid syntex at the top of the source file OR we can use html-include file inside the current layout file.
I prefer the latter.

Rmarkdown rticles - MDPI template. How to print your own abbreviations

I am using the MDPI template (from the rticles package), and keen to also use the glossaries packages so I don't have to manually feed all the abbreviation on the appropriate YAML field.
For such, I have loaded the LaTex package glossaries using the header-includes:
header-includes:
\usepackage{inputenc}
\usepackage[acronym, section=section]{glossaries}
\setacronymstyle{long-short}
\makeglossaries
\makeindex
\input{glossary}
after creating several acronyms within the Rmarkdown body, I would be willing to either input the latex commands and have it printed in within the "Abbreviations" section of the template.
Currently, I am able to hack it through the following steps (I am sure there is a better way):
1- keep all the aux files chunk with :
options(tinytex.clean = FALSE)
2- cmd makeglossaries "filename"
3- Raw Latex on Rmarkdown file:
\begin{abbreviations}
\setabbreviationstyle[acronym]{long-short}
\printglossary[type=\acronymtype,title={}]
\end{abbreviations}
However, I would be keen to know if I could insert something on the YAML and use the MDPI formatting.
Alternatively, I could edit the rticles MDPI template (but I am not sure how).
Any ideas?
Cheers,
Include in YAML:
include-after: glossary.tex
I tried without success, but it seems reasonable that this approach might work with a few modifications

how can I enable Markdown in fossil tickets

Fossil docs says that markdown can be used in tickets as well. But I do not manage to turn it on.
https://www.fossil-scm.org/xfer/tktview/35343257ffd02ba47880 reports a similar problem.
I read a solution in the Fossil-scm mail list but I cannot find the exact email now. However I put my TH1 templates for ticket in the following snippet:
https://bitbucket.org/snippets/ivzhh/GeL9pq
The basic idea is to set $mutype to markdown (x-markdown or x-fossil-markdown). Then add the redering code on line 75~82 in ticket-edit.tcl (the original solution is this post). The markdown rendering returns two values instead of one (default fossil wiki command). Please check the snippet.
I managed to get it work and have created a fossil repository with the three templates I created a repository with the patches on https://chiselapp.com/user/bwl21/repository/fossil-markdown-patches. The repository holds the files but also has applied the same in the configuration such that you can see how it works.
Thanks to #etc-100g

TinyMCE, Django and python-docx

I'm looking into using a rich text editor in my Django project. TinyMCE looks like the obvious solution, however i see that the output format is html (here). Goal is to store user input and then serve it inside a word document using python-docx( which is not html).
Do you know of any solution for this? Either a feature of tinyMCE or a html to word-format converter which keeps styles, or maybe another rich text editor similar to tinymce?
UPDATE:
This is another option which i found to be working fine. Still at the point of trying to convert HTML to Word without losing styles. A solution for this may be pywin32 as stated here but it doesn't help me that much + it's Windows only.
Update2
After quite some digging i found pandoc and pypandoc which appear to be able to translate in any of these output formats:
"asciidoc, beamer, commonmark, context, docbook, docbook4, docbook5, docx, dokuwiki, dzslides, epub, epub2, epub3, fb2, gfm, haddock, html, html4, html5, icml, jats, json, latex, man, markdown, markdown_github, markdown_mmd, markdown_phpextra, markdown_strict, mediawiki, ms, muse, native, odt, opendocument, opml, org, plain, pptx, revealjs, rst, rtf, s5, slideous, slidy, tei, texinfo, textile, zimwiki"
I haven't figured out how to integrate such an input to python-docx.
I had the same challenge. You'll want to use Python's Beautiful Soup library to iterate through the content in your HTML editor (I use Summernote, but any HTML editor should work) then parse HTML tags into a usable format for python-docx. Pandoc and Pypandoc will convert files for you (e.g. you start with a LateX file and need to convert it to Word), but will not provide the tools to need to convert to and from xml/html.
Good luck!