Can mmd6 latex support files be tweaked to support exporting mmd6 in-text citations to biblatex compatible commands?

glen's Avatar

glen

10 Jul, 2019 05:27 AM

I was wondering if there is a way to tweak the latex support files for mmd6/MMD Composer so that I can use the mmd syntax for in-text citations such that when exported to a latex file, instead of the natbib \citep or \citet commands preceding the .bib citation tag, the biblatex citation tag \autocite is used (see below).

I would like to be able to write the mmd citation like usual to read:
This is an idea that needs to be cited [][Smith2019]." and have the exported Tex file read:
This is an idea that needs to be cited \autocite{Smith2019}.

I do have the latest MacTex working with TexLive-2019 running on macOS 10.14.5, with the latest version of mmd6 (6.4.0) and MMD Composer, 4.5.12.

Just in case anyone is interested I do have biblatex working (except the mmd6 citation syntax) by:
1. Commenting out \usepackage[sort&compress]{natbib} command and adding in \usepackage[style=nlm, backend=biber]{biblatex} in the shared mmd6-memoir-packages.tex file. ('nlm' is the National Library of Medicine style, but any biblatex style could be used)
2. Adding \addbibresource{MyRefs.bib} before \begin{document} in the mmd6-article-begin.tex file.
3. By commenting out pagebackref %pagebackref in the mmd6-article-begin.tex file. Biblatex does not like this command.
4. Including the in-text citations like this as raw latex code in the mmd file like this: This is an idea that needs to be cited autocite{Smith2019}{=latex}.
5. Modifying the Bibliography portion of the shared mmd6-memoir-footer.tex file to look like this:

% Bibliography
\printbibliography

%\ifx\bibliocommand\undefined
%\else
%   \bibliographystyle{\bibliostyle}
%   \bibliocommand
%\fi
  1. glen closed this discussion on 13 Jul, 2019 07:04 PM.

  2. glen re-opened this discussion on 13 Jul, 2019 10:19 PM

  3. glen closed this discussion on 14 Jul, 2019 06:40 AM.

  4. fletcher re-opened this discussion on 14 Jul, 2019 02:23 PM

  5. Support Staff 1 Posted by fletcher on 14 Jul, 2019 02:23 PM

    fletcher's Avatar

    It's been a few years since I really dug into the core of LaTeX citation commands and syntax.

    To completely support what you desire would require modifying the latex support files, and then also the code of MMD itself. \citet and \citepare hardcoded in the latex.c file. You can modify that file to change the LaTeX output as desired.

    It shouldn't be hard to do.

    Fletcher

  6. 2 Posted by glen on 15 Jul, 2019 03:41 AM

    glen's Avatar

    Thanks! I was thinking along those lines. I wonder if it will be this simple, but I was thinking of substituting \autocite in the lines that involve a "print \citep or \citet" and recompiling.

  7. Support Staff 3 Posted by fletcher on 15 Jul, 2019 12:25 PM

    fletcher's Avatar

    That is basically the first step I would take. Then test it with your documents and see if anything unexpected happens.

    If you do this, I would recommend using git, working off the develop branch on the main repo, and creating your own branch from that. This would allow you to easily update your version whenever I update the main version without having to manually make all my changes. (You could work off master as well, but I don't update master as often, so you would get fixes faster if you work off develop.)

  8. 4 Posted by glen on 15 Jul, 2019 05:20 PM

    glen's Avatar

    Sounds good, I'll check out the newer stuff. By the way,, that simple substitution didn't do it as far as I could tell. After running the newly compiled version with that modified latex.c file, using the mmd citation syntax the exported .tex file still had the natbib citation tags and it appeared to trigger the bibliography commands that are normally in the mmd-article-footer.tex file. Strange, the bibtex/natbib commands in the mmd-article-footer.tex were commented out and the biblatex package replaced the natbib package command as described above in the mmd-packages-memoir.tex file. So I'm wondering if there is another place the bibtex commands are 'coming from'. In any case I'll keep experimenting with your newer stuff. Thanks!

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac