I would like to enter several formulas into my Doxygen documentation. Is there any way to create a label of some type that automatically numbers each formula? Ideally, the automatic numbering will work both in HTML generated output and within Latex generated output from Doxygen. I am looking for something similar to the Caption feature in MS Word.
Example:
You can see the results of my example in Equation 1.1 below.
{Some Formula}
Equation 1.1
{Some other formula}
Equation 1.2
In the example above, the number after "Equation" gets automatically generated. And then I can reference it in the text.
The \anchor feature in Doxygen would allow me to link to the locations. But I don't think that it would generate the auto-numbering correctly.
The option I thought of was to modify my CSS that I use for Doxygen. Currently I already modified it to automatically number my headings. And Latex automatically numbers headings 1-4 already. I could change my CSS to format Heading 4 so that it looks like a right-justified equation label. But I don't know how I can get Latex to use the same formatting.
Any helpful suggestions?
Thanks.
From what I learned, this can not be done in Doxygen. I am now considering two authoring systems to do this:
Doxygen to document the code.
Open Office / Libre Office to document user manuals, which is where the bulk of the equations are.
Both authoring apps will write HTML output. And then I will combine the output with Qt Help Project system.
Related
I am working on a scientific paper in R Markdown and it needs an abstract (with embedded results) at the start of the paper. Currently the paper has analyses interspersed before the paragraphs and/or tables and figures where I report the results. I can render the abstract at the end because all the parts have been calculated but I cant submit the paper like this. I hate to front load all the analysis code (out of context) so I have the numbers ready for the abstract.
Does anybody have a strategy for this?
I know I can manually cut and paste the abstract to the top after rendering the document but that wrecks an otherwise fully reproducible workflow.
The best idea I have come up with (but I have not tried yet) is to save the .md file that is generated as the Rmd is processed and then programmatically parse the file and feed the abstract then the body of the paper directly to pandoc.
Is there a good solution to this using Quarto?
Both rmarkdown (through {bookdown}) and {quarto} will allow you to assemble a series of rmd/qmd files into a single document and use a YAML file to specify the order in which they should be assembled.
I'm currently using something like this for developing a standard reporting format for some research on human/machine interfaces. Intended for an applied scientist/engineer audience, which is not so different from your academic journal application.
So I'm using RMarkdown with the Bookdown extension to take notes in math classes. Bookdown has several pre-defined math environments to include and auto-number theorems, definitions, proofs, etc.
These are implemented as special code chunks in RMarkdown; for example, this chunk with the {theorem} header renders the text as a theorem in the output
```{theorem}
Here is my theorem.
``\`
The issue I'm facing is that RMarkdown seems to be treating the text inside the body as code, and as a result, several convenient features of the RMarkdown editor do not work here. For instance, one cannot click on inline math to get a preview pop-up, and inserting a ' (like in variable names such as x') highlights the rest of the body in green (presumably because the editor thinks its the beginning of a string).
Is there a way to get the editor to treat the Bookdown math environments as regular text instead of code? Alternatively, is there a way to create special headers for math environments (like maybe # (thm) Pythagorean theorem)?
Any help will be appreciated.
I am new to R and Rmd and trying to generate a report using Rmd. This report has several images inserted along with the text. I am able to insert an image by hardcoding the path of the image. I have no problems with that but I need the path as a variable because it varies with the project. Can anyone help me with the syntax for calling a variable within a path to the image?
![Relatedness check](/data/array_processing/in_progress/Project123/files/data/plots/Project123.ibd.png)
"Project123" changes based on the project. Is there a way I can declare this variable and call it to define the path?
Help please.
Images can use online R code for dynamic paths and/or alt text. (Early adopters of rmarkdown often tried this method as the default method of including R plots in the reports, using png(filepath...); plot(...); dev.off() followed by what I recommend you use.)
This will allow you to do what you need:
![something meaningful](`r filepath`)
as raw markdown (and not inside a traditional code chunk).
If you aren't familiar with inline code blocks, then know that you can put just about anything in an inline code block. This is handy for including dynamic content in a paragraph of text, for example "the variance of the sample is \r var(sample(99))``". (Often it is just a pre-created variable, if numeric it is often rounded or formated to control the display of significant figures.)
I have a spreadsheet of exam questions that I want to use to generate quizzes and exams using R exams, and I'd like to include graphics in some of the questions.
The template here (http://www.r-exams.org/templates/fruit/) begins by defining the images as long base 64 encoded strings as generated by
base64enc::base64encode("file.png")
This seems fine, but if I have a dozen or so images of which I might only want a question to use one, two, or three images selected at random for programmatically generated exercises, how can I avoid including the encoding for all dozen images with every single exercise?
The best I can think of at the moment is to include LaTeX syntax for graphics inclusion in a spreadsheet of possible question options, and as exercises are generated, use regular expressions to find the file names inside the \includegraphics{} commands that will be included, encode those as base 64 strings, and include them in the exercise file, but I'm wondering if there's a way I can do this without writing my own code to parse LaTeX.
First a few clarifications:
The fruit exercises include the images as Base64 strings because the three icons are quite small (12K per icon) and it is convenient to have all information within the Rnw/Rmd exercise without the need to store graphics files separately. It is just one trick that can be nifty and that we wanted to demonstrate.
For more and larger images one could do the same trick but it is probably less convenient. To illustrate how static images can be included in an exercise, the following template is available: http://www.R-exams.org/templates/Rlogo/ It uses the include_supplement() function to declare a certain file as a supplement for the exercises. If this is a graphic it can then be integrated into the exercises via \includegraphics{...} in Rnw exercises and via ![...](...) in Rmd exercises.
Each exercise just has to include the supplements it actually uses (and not all files from which these were sampled). And there is no need to do the Base64 encoding manually. This is done by the exams2xyz(...) functions automatically if needed.
Now for the scenario you describe. Say you have an exercise foo.Rmd in which you want to show one of three static images foo-1.png, foo-2.png, foo-3.png and ask questions about it. Then your R code might do something like:
i <- sample(1:3, 1)
img <- paste0("foo-", i, ".png")
include_supplement(img)
which randomly selects one of the three files and declares it to be an attachment. Then within the question text you would include the image via something like:
![](`r img`)
Caveats:
The code above assumes that the PNG images are located in the same directory as the Rmd exercise itself. If it is in a sub-directory bar/ say, you would need include_supplement(img, dir = "bar") etc.
If this exercise is rendered into HTML then the original file name (foo-1.png or foo-2.png or foo-3.png) would be visible in the HTML source code. This may (or may not) provide a hint for students what the correct answer is. If so, it would be better to include the file with a neutral name, e.g., include_supplement(img, target = "foo.png").
In Rnw exercises the code for including the graphic would be something like: \includegraphics{\Sexpr{img}}.
Many of the math textbooks and other literature I read is in PDF format, so I frequently find myself annotating these with the Adobe Reader comments tool.
I did find a helpful guide here, but sometimes I'd like the option of inserting math symbols, too. Has anyone found a reliable way to insert math symbols, TeX, or other arbitrary formatting into the annotations?
So far, the best I've come up with is to enter the unicode prefixed by "0x" and hit alt+X after it. Maybe with the Adobe javascript SDK you could write a script to shortcut this.
I don't think any of the current commercial editors make this easy, which is too bad. I am sure the vendors monitor this site, so there is hope.
In the meantime, here is a manual workaround.
Use tikz to create your comment boxes. Here are the two examples I found to be most relevant: Boxes and Positioning. Play around with the options to get both the shape and the placement you want. Generate a pdf file from the latex source that contains your comments.
IMPORTANT: if your comments end before the last page of the original document, insert:
\pagebreak{} % create empty page
\thispagestyle{empty} % get rid of page numbers et al
~ % put a space so the page gets generated
before your \end{document}, to get an empty last page. The following command will reuse the last page of your comments document on all subsequent pages of the original document.
Use a recent version of pdftk with the multistamp command to overlay your equations file with your original file like so:
pdftk original.pdf multistamp comments.pdf output out.pdf
Also see this question.
The free (as speech) PDF tool, Okular, supports this functionality by putting latex formula directly between $$...$$.