Compile twice in django_tex - django

I need to compile a .tex file twice with django_tex in order for the table of contents to load correctly. Is there a way to tell the interpreter in django_tex to run the compiler twice (I use pdflatex)??
Code:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
\tableofcontents
\section{Introduction}
Introduction text.
\section{Second section}
Second section text.
\end{document}

django_tex seems to support latexmk, which will (amongst many other useful things, like running bibliography tools) automatically determine the required number of *tex runs.
To use this, you can follow the advice from https://github.com/weinbusch/django-tex/pull/5#issuecomment-447030408 and add
LATEX_INTERPRETER='latexmk -pdf'
to your settings.py.

Related

Identical rmd files create different latex files when run on two computers

When my colleague and I run the same Rmd file on our respective computers they produce different .tex files. This is a problem, because the tex-file my computer produces doesn't compile. Apparently there is some invisible local setting that is different between our computers but what could it be? I updated all the Rpackages I use but to no avail.
The Rmd file starts with
output:
bookdown::pdf_document2:
keep_tex: yes
toc: false
And both of us compile it by simply hitting the knit-button in Rstudio.
Noticeable differences in the tex-files are:
extra linebreaks in different places
a line that is commented out in the rmd-file (<!-- blabla -->) appears in my tex-file, not in his, but some other out-commented lines appear in neither (as they should)
at the end of lines in tables there is a \strut inserted in my tex-file but not in his
Section heads read \hypertaget{blabla} in his file but not mine
For none of these difference I can find any place in the Rmd-file where any choice w.r.t to this is made - apparently some local settings file I am not aware of is used in the process??
Please let me know if you need more information.
EDIT: we found a partial answer and full solution, but I am still interested in what the underlying mechanism is. It turned out that I was using an older version of Rstudio. (It took me long to find that out because the check for updates tool in Rstudio kept telling me that I was using the newest version, but that is a separate issue.) Using the same version of Rstudio we get the same result.
The translation from Rmd to tex has multiple steps:
All the code chunks are extracted and executed via knitr, resulting in a md file.
The md file is translated to tex via pandoc.
For most people pandoc comes bundled with RStudio. So when you updated that, you got a more recent pandoc version. You can test for the used pandoc version with rmarkdown::pandoc_version().

debugging options with rmarkdown

I am using the rmarkdown with the rshiny for generating word file reports. I am using the R studio-server for development. On executing the rshiny application, it halts due to some error in the one of the rmarkdown.
The error says...
Quitting from lines 11-486 (/home/KS127/dev/shiny_apps/pashiny/inst/shiny/dataframe_source.Rmd)
Quitting from lines NA-486 (/home/KS127/dev/shiny_apps/pashiny/inst/shiny/dataframe_source.Rmd)
It's providing the line numbers which are not useful to identify the root cause. Adding print statements are also not useful as I am generating the word file report, until and unless the complete .Rmd doesn't get successfully executed, I won't be able to see print statements output.
I tried changing the rmarkdown output setting from chunk output inline to chunk output to console as mentioned here as well but it is of no use.
Is there any way to print the .Rmd file print statements or the output to the console or is there any way to debug the .Rmd file?
In addition to my comment above, Abhinandan, I've recently stumbled across a new package, called testrmd.
Although it is new, it seems to work with a number of different test packages and provides a useful front-end for Rmarkdown documents. (I'm certainly going to use it.)
You might want to check it out. Here's the link: https://github.com/ropenscilabs/testrmd.
I hope this helps you.
See My .Rmd file becomes very lengthy. Is that possible split it and source() it's smaller portions from main .Rmd?
That's what I do. -
Split your code chunks in separate files and add them one by one

Doxygen, nothing shows up in Graphical Class Hierarchy

I'm trying to use DOxygen to generate documentation for a rather large code base.
I got Doxygen 1.8.10 for Windows with Doxywizard.
I installed Graphviz 2.38
I was able to generate the Textual Class Hierarchy without a problem using Recursive option in the Expert tab.
I selected the "Use dot tool from GraphViz package" option in the Wizard.
I also checked "HAVE_DOT" and "CLASS_DIAGRAMS" options in the Expert tab for Dot.
When I generate the documentation and click on Show HTML Output, I cannot see anything under the Graphical Class Hierarchy. I can still see all the classes and their dependencies in the Textual Class Hierarchy.
in Mozilla Firefox, the Graphical Class Hierarchy page shows up as empty
in Internet Explorer, the Graphical Class Hierarchy page shows a lot of broken image icons aligned in 1 column
What am I doing wrong here?
Thank you,
When you select HAVE_DOT in the Expert Tab, doxygen will assume you have DOT available from the PATH. You need to make sure of this.
However, you also have the DOT_PATH option. Here you can put the path where DOT can be found.
I was able to solve this issue by executing a simple line on CMD which iteratively generates the missing .png files from .dot files.
for %f in (*dot) do dot %~nxf -Tpng -o %~nf.png
Make sure to execute this in /html folder where all .dot files reside and have dot.exe in your PATH environment variable. Also, If you receive any syntax errors, such as:
syntax error in line 1 near 'ëPNG'
try changing the default program of .dot format to Notepad (mine was set to Word).

How to write C++ code to fit within LaTeX listings margins

I'm using the listings package in LaTeX to include source code, but some of my source code runs off to the right and so some lines are obviously too long. Does anyone know if there is a way to mark the margin when I'm writing the code, perhaps depending on the \setlength parameters I set in my LaTeX environment so that I know to stop there? I'm using Microsoft Visual C++ 2010 and TeXworks for this particular problem, but I often just use Emacs to write both C++ code and LaTeX.
Here's a snippet from LaTeX I'm using:
\lstdefinestyle{C++}
{float=h!, frame=single, language={[Visual]C++}, numbers=left, numberstyle=\tiny, tabsize=2}
\lstinputlisting[style=C++, label=lst:RANDU, caption=RANDU C++ Implementation]{RANDU.cpp}
Here's a snippet of what the output of this looks like, I'd like to know where to end lines in my IDE so that it doesn't exceed the right border:
Thanks in advance!
You could use packages like fill-column-indicator or column-enforce-mode. Both available also with MELPA.
The downside is that you will need to manually update the number of columns you want when you update your \setlength, unless you write some code to do it for you.
Use: breaklines=true in the options. Example:
\lstdefinestyle{C++}
{
float=h!, frame=single, language={[Visual]C++}, numbers=left, numberstyle=\tiny, tabsize=2, breaklines=true
}

Clojure: Marginalia: Multi Page Documentation

Question
(run-marginalia {})
produces a single file, docs/uberdoc.html
I would prefer it to produce many files in docs/*, one per *.clj file
Motivation:
I really like marginalia. I have recently started using it, and it's causing me to want to write documentation, as impossible as that sounds.
However, I have this problem that whenever I write docs, and refresh, and reload uberdoc.html, I lose the part of the doc I was previously looking at. Thus, I would prefer a system where each *.clj file had it's on *.html file for documentation. Is this possible with marginalia 0.7.0?
Thanks!
There was a mutlidoc functionality in a previous version, but it is not at command line in the latest version. However, by running something like (multidoc! "./docs" (find-processable-file-paths "./src" #"\.clj$") {}) you should get directory of individual files.
https://github.com/weavejester/codox is another Clojure documentation tool (which gives separate pages - see http://number23.github.com/commons-lib/)