What is the Markdown equivalent to LaTeX's description environment? - list

Is there a Markdown equivalent to LaTeX's description environment? This gives an author the ability to generate lists where the first word is boldfaced, like this:
The LaTeX source would be:
\begin{description}
\item[First] The first item
\item[Second] The second item
\item[Third] The third etc \ldots
\end{description}
I'd like to replicate this in Markdown so that if I run the Markdown through a tool such as pandoc I will get similar results.

Markdown isn't as comprehensive as LaTeX, or even HTML:
Markdown’s syntax is intended for one purpose: to be used as a format for writing for the web.
Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags.
It supports bulleted and numbered lists, but not defiition lists.
However, you mention using "a tool such as pandoc" to process your input file. Pandoc supports inline LaTeX using the raw_tex extension:
Extension: raw_tex
In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be included in a document. Inline TeX commands will be preserved and passed unchanged to the LaTeX and ConTeXt writers. Thus, for example, you can use LaTeX to include BibTeX citations:
This result was proved in \cite{jones.1967}.
Note that in LaTeX environments, like
\begin{tabular}{|l|l|}\hline
Age & Frequency \\ \hline
18--25 & 15 \\
26--35 & 33 \\
36--45 & 22 \\ \hline
\end{tabular}
the material between the begin and end tags will be interpreted as raw LaTeX, not as markdown.
Inline LaTeX is ignored in output formats other than Markdown, LaTeX, and ConTeXt.
So simply including your LaTeX description environment and running Pandoc with the raw_tex extension should give you the result you want.
You may have to specify the source format manually, e.g. by using something like -f markdown_strict+raw_tex in your command.

If you are using the latest version of Pandoc (ver 2.0+), you can use the definition lists notation, as shown below. This would be much easier.
First
: The first item
Second
: The second item
Third
: The third etc

Related

How to stop R Markdown from converting LaTeX to odt/word formulae?

I use R Markdown to write some statistical analysis reports that then need to be modified in LibreOffice (or Word). I use a library (papaja) that is extremely useful but forces me to use LaTeX that Pandoc then converts to formulae. I don't want it to be converted. The only thing I want to preserve form LaTeX formatting is italic for letters. That's exactly what I get when I use rtf_document as my output format – LaTeX letters are converted to italic, numbers to regular text. Is there a way to stop Pandoc from converting LaTeX to formulae when using odt_document or word_document as output? A work-around is to use rtf_document and then convert it to .odt with LibreOffice.
Example:
---
output: odt_document
---
The model fits the data ($F(3, 596) = 13.19$, $p < .001$).
What I get:
What I want to get:

R Markdown beamer title

I am preparing a beamer presentation with R Markdown and need to use special character in the title a “long Hungarian umlaut”. Using the character “ő” is written out as a regular “o” and using \H{o} gets execution to halt but works in regular text. Someone that know how to get around this?
What LaTex package uses the \H{o} command? If it needs this package, you need to include it in your markdown document
To do this, include this in your header as such:
---
title: TITLE
author: AUTHOR
header-includes:
- \usepackage{YOURPACKAGE}
---
Then, when in your title, encapsulate the command with $\H{o}$ which should make pandoc recognize that its a latex command.
However, I am not sure if this would work if you use a latex command in the title inside the yaml header.

Doxygen parsing ampersands for ascii chars

I've been using Doxygen to document my project but I've ran into some problems.
My documentation is written in a language which apostrophes are often used. Although my language config parameter is properly set, when Doxygen generates the HTML output, it can't parse apostrophes so the code is shown instead of the correct character.
So, in the HTML documentation:
This should be the text: Vector d'Individus
But instead, it shows this: Vector d'Individus
That's strange, but searching the code in the HTML file, I found that what happens is that instead of using an ampersand to write the ' code, it uses the ampersand code. Well, seeing the code is easier to see:
<div class="ttdoc">Vector d&#39;Individus ... </div>
One other thing is to note that this only happens with the text inside tooltips...
But not on other places (same code, same class)...
What can I do to solve this?
Thanks!
Apostrophes in code comments must be encoded with the correct glyph for doxygen to parse it correctly. This seems particularly true for the SOURCE_TOOLTIPS popups. The correct glyph is \u2019, standing for RIGHT SINGLE QUOTATION MARK. If the keyboard you are using is not providing this glyph, you may write a temporary symbol (e.g. ') and batch replace it afterwards with an unicode capable auxiliary tool, for example: perl -pC -e "s/'/\x{2019}/g" < infile > outfile. Hope it helps.
Regarding the answer from ramkinobit, this is not necessary, doxygen can use for e.g. the Right Single quote: ’ (see doxygen documentation chapter "HTML commands").
Regarding the apostrophe the OP asks for one can use (the doxygen extension) &apos; (see also doxygen documentation chapter "HTML commands")).
There was a double 'HTML escape' in doxygen resulting in the behavior as observed for the single quote i.e. displaying '.
I've just pushed a proposed patch to github (pull request 784, https://github.com/doxygen/doxygen/pull/784).
EDIT 07/07/2018 (alternative) patch has been integrated in main branch on github.

Change font style for RegEx globally in LaTeX

Although I know that Latex is a "semantic language", I´m trying to find a solution for the following problem.
In my 60k words document are about 250 strings I can search for via a RegEx, e.g. something like [A-Z]{2}\d\d[A-Z]{2} for a string like SE25GH.
Is it possible to define a font style for this RegEx string globally in my document, so that I can change it easily without crawling through my document or typing a defined command like \makemytextbold{SE25GH}?
Thanks.

Applescript to extract the Digital Object Identifier (DOI) from a PDF file

I looked for an applescript to extract the DOI from a PDF file, but could not find it. There is enough information available on the actual format of the DOI (i.e. the regular expression), but how could I use this to get the identifier from the PDF file?
(It would be no problem if some external program were used, such as Hazel.)
If you're ok with using an app, I'd recommend Skim. Good AppleScript support. I'd probably structure it like this (especially if the document might be large):
set DOIFound to false
tell application "Skim"
set pp to pages of document 1
repeat with p in pp
set t to text of p
--look for DOI and set DOIFound to true
if DOIFound then exit repeat--if it's not found then use url?
end repeat
end tell
I'm assuming a DOI would always exist on one page (not spread out to between two). Looks like they are invariably (?) on the first page of an article, which would make this quick of course, even with a large doc.
[edit]
Another way would be to get the Xpdf OSX binaries from http://www.foolabs.com/xpdf/download.html and use pdftotext in the command line (just tested this; it works well) and parse the text using AppleScript. If you want to stay in AppleScript, you can do something like:
do shell script "path/to/pdftotext 'path/to/pdf/file.pdf'"
which would output a file in the same directory with a txt file extension -- you parse that for DOI.
Have you tried it with pdfgrep? It works really well in commmandline
pdfgrep -n --max-count 1 --include "*.pdf" "DOI"
i have no idea to build an apple script though, but i would be interested in one also. so that if i drop a pdf into that folder it just automatically extracts the DOI and renames the file with the DOI in the filename.