Showing posts with label markdown. Show all posts
Showing posts with label markdown. Show all posts

17 December, 2015

Lo and Behold! My BibTex compiler works ...

A (oh horror!) .docx file in Libre Office

In order to make a literature review I need to compile a MySQL table in the BibTex format.

Now I've got a file, that looks pretty much like a BibTex formatted file. It's compiled from a MySQL database and the output is formatted by PHP.


In the php code this loop will format the output:

while($row = $result->fetch_assoc()){
    $books[] = "\n@". $row['Type'] 
     ."{" . strtoupper( substr($row['Author'], 0,4)) 
     . "_" . $row['Year']
     . ",\n Author={" . $row['Author'] . "},\n"
     . "Title={" . $row['Title'] . "},\n"
     . "Publisher={" . $row['Where'] . "},\n"
     . "Year=" . $row['Year'] . "}\n";
   }

I made a simple markdown file and compiled it with pandoc. The result was a .docx file.

Here is the output from the database formatted via PHP:

@Book{ARIS_1958,
 Author={Aristoteles},
Title={Poetik},
Publisher={Hans Reitzels Forlag},
Year=1958}

etc. etc. etc. etc. etc.

The markdown contains a reference to a book in the BibTex file:

[@ARIS_1958]

Finally the markdown is compiled via pandoc thus:

# pandoc --bibliography=libri.bib test.md -o test.docx

The image above is a screendump from the docx-file in Libre Office. I only refered to Aristoteles, and that's the only work in the list of sources.

Ergo: Q.E.D.

That is: this is just a toolbox. The next step is literature research for the WordPress and Open Source CMS Research Project @ Business Academy Aarhus. And perhaps: come up with title with > x-factor.

08 May, 2015

Add quotes to markdown in pandoc

The Markdown File

Add a yaml metadata section, that will point to a BibTex (.bib) file. The yaml section can be placed anywhere in the document:

---
title: "Sample Document"
output: html_document
bibliography: bogliste.bib
---

Citation in the markdown
Lorem ipsum dolor sit [@PHPWeb]

The citation points to a post in a BibLatex file in this case edited in Pybliographer:



@Book{PHPWeb,
  Author         = {Ullman, Larry},
  Title          = {P{HP} for the {W}eb},
  Publisher      = {Peachpit Press},
  year           = 2011
}


Compile html from the markdown
In order to create the file pandoc should make a standalone file (-s) and pandoc must know the name of the bibliography file (--bibliography=books.bib)

# pandoc -s --bibliography=books.bib yaml-test.markdown > yaml-test.markdown.html

Missing pandoc-citeproc
Linux Mint gave an error. Pandoc-citeproc was missing. Tried to install the package, and then the problem was solved.

#  sudo apt-get install pandoc-citeproc

Result
Lorem ipsum dolor sit (Ullman 2011)

At the end of the document the reference will appear, so you might add some markdown to state that here comes the list of sources. From the booklist the quoted (and only the quoted!) work will appear:

Ullman, Larry. 2011. PHP for the Web. Peachpit Press.

21 April, 2015

Pandoc slides

I made a markdown slideshow but got an error message when I wanted to convert the .md to .pdf. Here's a Linux Mint solution.

Error:

pandoc: Error producing PDF from TeX source.
! LaTeX Error: File `beamer.cls' not found.

Type X to quit or to proceed,
or enter new name. (Default extension: cls)

Enter file name:
! Emergency stop.

       
l.2 \usepackage

Solution:

# sudo apt-get install latex-beamer

Then the code worked like a charm:

# pandoc lastlesson.md -t beamer -o myslides.pdf

19 April, 2015

Lyx to markdown

Export from Lyx to Latex. Then convert the .tex file to markdown via Pandoc:

# pandoc --no-wrap -f latex -t markdown myfile.tex > myfile.md

18 April, 2015

Markdown

I need more and more info about markdown. E.g. how to add pictures and similar

See here!.

BTW this is how to do it in Pandoc / Dexy:

![Screendump](billeder/screendump.png "Screendump")