I'd like to include some latex code in my .Rmd file so that when I do:
knit('file.Rmd')
pandoc('file.md', format='latex')
then the .tex file is processed with
\usepackage{mathpazo}
in the preamble of the latex file? Is this possible, by adding the preamble text somehow dierctly into the .Rmd file, similar to what can be done with embedded configs:
https://github.com/yihui/knitr-examples/blob/master/088-pandoc-embedded.Rmd
(lines 5--13).
Or do I have to create some extra templates in my homedir for pandoc to find?
Thanks, Stephen
Related
My main propose of using pandoc is to make word documents from latex files, so I share them with my colleagues for review. I am new in pandoc, so I used a straightforward example.
I used pandoc to create a docx file form a simple Latex tex file, which had a simple one citation. The docx file is created successfully, However, when I wanted to reverse the process and create a Latex file from the newly created docx file. The citations are copied in the newly tex file just as simple text, without any citation command in latex. Is there any way you can transfer citations from docx file to latex file, and store them is some kind bib file through panndoc?
-s input.tex --bibliography=b.bib -o output.docx
-s output.docx --bibliography=b.bib -o input.tex
Change the word reference style to "export bibtex" and at least you can copy paste the references into a bibtex file. References inside the text are kind of okay. References in footnotes don't work so well
I'm using a markup language called AsciiDoc (*.adoc). I'd like to name my *.adoc files as *.txt [^1]. However, then GitHub (of course) doesn't draw .txt files as .adoc files.
So I tried to override the file types using .gitattributes as this:
*.txt linguist-language=AsciiDoc
But it didn't work. Any help? Thanks.
[^1]: Since Dropbox doesn't support editing .adoc files, I'm using .txt for AsciiDoc files.
It seems that linguist-language correctly syntax highlight the file but fail to render markup. I've found that emacs and vim modelines actually works for rendering markup though.
So a workaround would be to add the following in each txt files :
////
vim:ft=asciidoc
////
or if you prefer emacs :
////
-*- mode: asciidoc;-*-
////
Checkout this gist
In pseudo-code I'd like to do the following in my org-mode file:
#+BEGIN_src python
[[./a_python_script_whose_contents_i_want_in_my_document.py]]
#+END_src
i.e. have the entire contents of a separate file be embedded in my org-mode document when I export it to latex.
How do I embed the contents of a separate file within an org-mode document, and have that content be formatted as source code when exporting?
There is no way to do that in org-mode with a source block that I know of. This will give you what you want if you have minted setup:
\inputminted{python}{your-script.py}
or if you use lsting
\lstinputlisting[language=Python]{source_filename.py}
In latex we can split a big document(paper.tex) into several tex files(abstract.tex,intro.tex ...) which can be inserted inline using \input{paper.tex}.
Is there a similar facility in org-mode?
Just use the include command i.e.
#+INCLUDE abstract.org
#+INCLUDE intro.org
This will inline abstract.org and intro.org in the current org file. See also the org-mode documentation on include files.
Without test, but I think you can just simply add the latex command \input{paper.tex} in any place of .org file you want. It will render the .tex file to final file.
PS: other option: Include-files which are mentioned in the comment.
I use Aquamacs and TeX Live 2009 to edit my LaTeX files. As my publications tend to get quite big, I want to structure the source folder containing all my LaTeX files. Like e.g.
[bib]
[images]
[chapters]
chapter1.tex
chapter2.tex
main.tex
One can define the %%% TeX-master: "main" local variable at the end of each "sub" file to define a master file that contains all headers etc. That works fine if the subfiles are in the same directory as the main file. If I try to define the main file here (e.g. main.tex in chapter1.tex), LaTeX cannot find the specified file.
What can I do in this case?
In Aquamacs' menu bar go to Latex / Multifile/Parsing / Reset Buffer or Shortcut ^C ^N.
When specifying %%% TeX-master: "../main" in one of the chapters in the subfolders, the main tex file is correctly compiled!
Just an idea (not tested):
%%% TeX-master: "../main"
.. is the usual Unix shortcut for one directory level above. I don't know if this works for the TeX-master variable of AUCTeX, but it is worth a try.
The main latex file which contains all the headers and gets compile can include all the chapter files via:
[...]
\input{chapters/chapter1.tex}
\input{chapters/chapter2.tex}
\input{chapters/chapterTitleOfChapter.tex}
[...]
You do not need to have each chapter include the main file. Or am I missing something you are doing?