Use of out.extra generates Package keyval Error: style undefined - pdf

I am new to R Markdown and I am trying to generate a pdf report for my class. I have a small figure that I do not want taking up so many lines and surrounded by white space, so I'd like to wrap text around it. It can be aligned left or right, it doesn't matter.
I have tried a solution I found here, but
{r plot, out.width="4in", out.extra='style="float:right; padding:10px"', echo=F}
knitr::include_graphics("myplot.png")
throws the following error:
"! Package keyval Error: style undefined."
and the document won't compile. I have searched high and low and can't find a solution anywhere.

Related

LaTeX introduces non-existent excess space on pdf insertion

I try to insert a PDF file into my LaTeX document. It is properly cropped (by using the "Inkscape trick") and should easily be inserted without a problem.
LaTeX however, introduces a huge white space in the document which forces itself to create a "blank" extra page just to fit the PDF to the pages.
Just like this:
This is the code creating the problem.
\end{minipage}
... % Other code
\pagebreak
\subsection[Diagramm]{\uline{Diagramm}}
\vspace{-15pt}
\begin{figure}[H]
\centering
\includegraphics[height=0.98\textheight]{Abbildungen/ASMD_Diagramm_v2_X.pdf}
\caption{ASMD-Diagramm}
\label{Fig ASMD-Diagramm}
\end{figure}
... % Other code
\pagebreak
Now I have another PDF which is inserted properly and exactly as expected.
I have tried the following already:
Recrop the PDF
Using the trim command of \includegraphics
Resizing
Using other file formats (all were not satisfactory)
To be honest I don't know much about LaTeX and am more of a beginner-intermediate user than someone who really know this stuff. But this bothers me and has bothered me for quite a long time already. Anyone has any idea on how to fix this or what I am doing wrong?
Thank you!
Solved the problem. As discussed with samcarter, the space around the pdf file in the document seems to have been too small, so LaTeX couldn't accomodate for the caption, header, etc.
By trial and error, I just changed the size from:
...
\includegraphics[height=0.98\textheight]{Abbildungen/ASMD_Diagramm_v2_X.pdf}
...
to
...
\includegraphics[height=0.95\textheight]{Abbildungen/ASMD_Diagramm_v2_X.pdf}
...
and now it fits quite well on the page.

Why Merriweather Sans duplicate l in flying point?

When I type "Col·laborador" I get exactly this with other letter types:
but with Merryweather Sans, I get "Coll·laborador":
I use ttf-merriweather-sans 1.006-3 in ArchLinux
The problem lies in that font's OpenType definition.
Its author included a locl OpenType feature for the language code CAT (Catalan) that was supposed to replace the combination /l' /cdot' /l with /ldot. The ' characters after the first two names indicate what characters are to be replaced by the new one (http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html#5.e). However, the author made a mistake there:
replace /periodcentered after /l before /l with /ldot
and so it replaces just the dot character with ŀ. That means that you get this
with an OpenType-aware program such as Adobe InDesign (and only with the applied language set to "Catalan"). Note the double l, as in your own findings.
The output from another program confirms this; characters that do not take part of a replacement are in gray, replaced characters are in black.
Both /ls are in gray, only the center dot is black. A correct definition should have shown the left hand l and L in black as well.
The font you link to is version 1.006; an older Merriweather Sans that I found (1.003) does not contain this particular OpenType feature and so does not display this error.
To fix it, adjust the OpenType code and regenerate it from its source, or contact its author. Contact details are on the Google Fonts page for this font. (I have left a message in there, referring to this question.)

Knitr Spin and Rmarkdown Fig.cap (figure caption). Producing double numbering pdf document

I am referring to this Suppress automatic figure numbering in pdf output with r markdown/knitr
which I don't think was answered fully.
Essentially, I am using knitr::spin and rmarkdown to produce word, pdf and html documents.
For word, there appears to be no numbering when one puts in
+fig.1, fig.cap = "Figure name"
You only get an output Figure name in the caption.
To solve that, I used captioner class.
figs = captioner("Figure")
That works fine for word
But I am not faced with rewriting the script for pdf document as the caption turns up as figure 1: figure 1: The name
I am using knitr::spin to actually generate the RMD document for forward outputs in word and pdf.
I am not sure I can use hooks in knitr::spin, as I have tried it as advertised but can't get it to work.
I also tried
header-includes: \usepackage{caption} \usepackage{float}
\captionsetup[table]{labelformat=empty}
\captionsetup[figure]{labelformat=empty}
as suggested somehere to surpress the prefix for pdf but I get errors from pandoc. It uses pdf2latex.
I am not sure how one would query the output format in knitr::spin to actually produce different actions for different formats which could be a solution although cumbersome.
Thank you so much for your help from a novice.

Latex escaping in MatPlotlib

There are a number of situations where it is useful to set matplotlib.rcParams['text.usetex'] = True. In this case, special LaTeX characters such as % have to be escaped in places like axis labels. Is there a function built in to matplotlib for escaping LaTeX symbols?
There is a hint of such a thing in the docs here and here, but no clear mention.
The specific problem I am trying to tackle is using a matplotlib.ticker.PercentFormatter, where a custom symbol (symbol=r'\%') must be used if rcParams['text.usetex'] is true. I am trying to add a PR that will escape the percent symbol in PercentFormatter if rcParams['text.usetex'] is enabled, but it does not make sense to only check for the percent symbol in that case, so I would like to escape the entire symbol string.

How do I change the way syntax warnings for a missing semi-colon (red squiggly lines) are generated?

I love the fact that IntelliJ evaluates my code for syntax errors, but I don't like that it shows common errors on the current line as I'm typing.
There are several examples of this, but the most common one is the red error line (squiggly underline) for a missing semi-colon. I don't want the editor to check for this error until after I've finished typing the line and have pressed return. In fact, I really don't want the editor to evaluate the current line for ANY syntax errors until after I've completed it. The constant changing of the error indicators on the current line as I type is getting annoying.
I've looked around in the various options, but I can't seem to even find the name of squiggle line feature. It isn't code analysis, as that applies to the red and yellow indicators in the right margin. What is the name of this feature, and where can I find the options for it?
Example ( '|' is the current carrot position, '~~' are the red error lines)
System.Out = |
~~
The issue isn't limited to just the semi-colon, but for all sorts of other common syntax issues that I know I know about and will fix before moving on to the next line.
Update: I think the name of the feature is "error highlighting". But I still can't find any way to disable it for the current line. The closest I found was Setting --> Editor --> General --> Error Highlighting --> Reparse Delay, but that changed it globally with no option for just the current line.
There is no option in IntelliJ IDEA to disable error highlighting for the current line.
You can change the Settings -> Editor -> General -> Error Highlighting -> Auto reparse delay (ms) to something more comfortable, e.g. 3000 ms.
It will still highlight the error, but not immediately.