Figure captions for knitr blocks that include links in pdf documents - knitr

I have small bookdown 'book' that includes the following code:
A concept map is a diagram that shows 'ideas' and the relationship between those ideas. An example of a concept map is shown in Figure \#ref(fig:exampleCM).
```{r exampleCM, fig.show='hold', fig.cap='An example concept map --- Source: [Wikipedia](https://upload.wikimedia.org/wikipedia/commons/d/df/Conceptmap.png "Concept Map from Wikipedia")', echo=FALSE}
knitr::include_graphics('images/ConceptMap.png')
```
If I render the book as HTML everything works as expected. The caption includes a hyperlink to wikimedia/wikipedia. I.e., the caption looks like this:
Figure E.1: An example concept map — Source: Wikipedia
If I render the book as PDF, the caption in the PDF looks like this:
Figure E.1: An example concept map -- Source: [Wikipedia](https://upload.wikimedia.org/wikipedia/commons/d/df/Concep
"Concept Map from Wikipedia")
It seems that the rmarkdown doesn't get rendered for some reason. The LaTeX file that is produced is like this:
A concept map is a diagram that shows `ideas' and the relationship between those ideas. An example of a concept map is shown in Figure \ref{fig:exampleCM}.
\begin{figure}
\includegraphics[width=12.33in]{images/ConceptMap} \caption{An example concept map --- Source: [Wikipedia](https://upload.wikimedia.org/wikipedia/commons/d/df/Conceptmap.png "Concept Map from Wikipedia")}\label{fig:exampleCM}
\end{figure}
I wonder how I might fix this.

The comment above by Yihui Xie did the trick.
Thanks for reminding me about text references.

Related

DITA: reuse the same text multiple times with different variable setting for each instance

I'm working on a document where, among other things, I need to explain two units that are very similar. I want to reuse text in both descriptions, but I want to use the name of the units in the shared text, and to configure a form of substitution/variable so the name of the units appear in each description. Note that the description of both units appear in the final document.
We're using a structure like this:
top.ditamap, which includes:
units_a_and_b.ditamap, which includes:
unit_a.dita
unit_b.dita
and then this file with text snippets:
unit_a_b_shared.dita
unit_a.dita and unit_b.dita will conref text snippets from unit_a_b_shared.dita.
So basically I want unit_a_b_shared.dita to contain something like this:
"When you configure DOODAA to ..."
and then I want DOODAA to be replaced with unit_a inside the unit_a part of the document, and with unit_b inside the unit_b part.
I've tried to use keywords for this, but so far without success. I haven't found a way to make them take on different values in the different files, even when using keyscopes as explained here:
https://blog.oxygenxml.com/keyscopes/keyscopesBlog.html
The problem seems to be that with keyscopes I need the full path, which includes which unit it is, and hence cannot be used in the text snippet which is shared. Without keyscopes the first definition of the keyword applies everywhere.
Any suggestions on how to achieve this goal (using keywords or not)?
I wrote that key scopes article on the Oxygen XML Blog and I think that key scopes seem to be the answer for your case.
So the "unit_a_b_shared.dita" file would have inside a something like:
<p id="reusablePara">some text before <ph keyref="unit"/> some text after</p>
And then in the DITA Map you would refer to ""unit_a_b_shared.dita"" in different key scopes and re-define the key "unit" in those places to bind it to a different value.
The DITA Map would need to look like this:
<map>
<title>Main</title>
<topicref href="unit_a.dita" keyscope="unitA">
<keydef href="unit_a_b_shared.dita" keys="reusables"/>
<keydef keys="unit">
<topicmeta>
<keywords>
<keyword>KM</keyword>
</keywords>
</topicmeta>
</keydef>
</topicref>
<topicref href="unit_b.dita" keyscope="unitB">
<keydef href="unit_a_b_shared.dita" keys="reusables"/>
<keydef keys="unit">
<topicmeta>
<keywords>
<keyword>KG</keyword>
</keywords>
</topicmeta>
</keydef>
</topicref>
</map>
and inside "unit_a.dita" you would conkeyref to the reusable paragraph inside the "unit_a_b_shared.dita" file:
<p conkeyref="reusables/reusableParagraph"/>
Note that I'm using "conkeyref" not "conref". Once you get to use key scopes you should avoid direct links or direct content references, use only indirect linking using keys.

Get Font Properties From Word Document With OpenXML (.NET)

How can I get font properties from word document with OpenXML?
var para = wordDocument.MainDocumentPart.RootElement.Descendants<Paragraph>().ToList();
With the code above, I can only get the paragraphs themselves.
Only font insertion shown in forum.
Please help me..
Although i don't really know, what 'font-properties' means in this context, my answer is: it depends.
styles (templates defining paragraph or run format, etc) are set in MainDocumentPart.StyleDefinitionsPart
formatting properties are defined in RunProperties or ParagraphProperties (applied styles can also be found here)
So if you like to retrieve certain formatting properties, you will have to look inside the openxml-package.

is there a way to add custom labels to doxygen output?

If you use doxygen, you'll have noticed how certain adornments can appear in the header bar for the detailed info for a given function. Here's an example, it has the inline adornment, another one I've seen is static and I expect there are others.
I'm actually using doxygen to document Javascript on a mixed C++/Javascript project and would like to put an async adornment into the documentation for functions that are asynchronous. I'm using Coherent labs excellent script to do to this.
So, is there a way to insert custom adornments? I'd like the syntax to be something like this:
/// #adorn async
I don't see a direct solution in doxygen for "custom" labels. Problem would of course also be that it should work for all output types.
In e.g. LaTeX / PDF the static is shown as [static].
In HTML I think the relevant part is:
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
Maybe you could do something with the css files / or embedding a javascript script in the HTML code.
Other solution would be to add a command to doxygen that handles this type of requests, but this would mean again a new command in doxygen.

Word add-in js getHtml() function not return all fully style

I write word add-in in JS using this API: https://dev.office.com/reference/add-ins/word/word-add-ins-reference-overview
When I use function body.getHtml() I get almost everything , but some style is missing ,for example table of content is not with style, and when I use body.insertHtml() all style of table of content is not exist.
I success to get all style with body.getOoxml() function but it's very very long when I compare it to the html and this is bug problem for me .
What could I do?
Thank you
The issue here is that when you create a TOC what really happens in the doc is that we insert a special type of content control wrapping the TOC and we don't roundtrip it in docx-html conversions. In fact, if you save your TOCed document as HTML you will see that the style is lost in the resulting html. FWIW the links on the resulting HTML are functional.
That said, your only option as of now is to go OOXML.
thx,
Juan.

Remove street numbers from OSM maps

I'm still working on my map project. I use mapnik tools to render my own maps.
Mapnik reads a xml file to style each tiles.
At this moment, i managed to remove street names and all stuff that was useless for my project. The only problem i have is about removing the street numbers, which still appear even when all useless layers are off.
I give you a pastebin link to my xml file: http://pastebin.com/ZRtmYBRz.
Do you know how i can remove the street numbers ? Thanks.
Before :
Now:
Try using a filter on the addr:housenumber tag of the nodes in the source file that contain that info. Once you get those, you can change the rendering by using a TextSymbolizer.
More info on https://github.com/mapnik/mapnik/wiki/TextSymbolizer