Change options of already used latex package with doxygen - cmake

I'm using cmake with doxygen to generate documentation based on some markdown files. There are some special characters in those markdown files that I can't control (add by users and I just run my script). I found a solution by using the option utf8x instead of just utf8 with the inputenc package and use ucs package as well.
So, I added the following line into CMakeLists.txt file:
set(DOXYGEN_EXTRA_PACKAGES ucs "[utf8x]{inputenc}")
Which lead to having the following lines in refman.tex file:
% Packages requested by user
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
The problem is, there is already \usepackage[utf8]{inputenc} in the file which lead to an error on generating the pdf file using make pdf.
I can solve that by have a special bash/python script that replaces \usepackage[utf8]{inputenc} with whatever I want, but it seems strange to me that there is no way to make doxygen replaces/removes aready used packages as there is already EXTRA_PACKAGES which can be used to add extra packages.

Related

How to format markdown and all code in it?

I have a bunch of markdown files in my github repo. As there are many members in the team, the syntax of markdown and code in markdown files are hard to be standardised.
What I want is:
Create a github action that modify those files automatically when there is a push.
I can't find a markdown prettifier that format the code as well. (e.g. putting spaces around '=')
The solutions that I can think out of are:
Use a CLI tool that can do all the stuff
Use a tool for markdown, use a script to filter all code in it and parse it to anther tool
Send http requests to those online prettifier if such CLI tools do not exist
Note: I have Java, Cpp, Swift and more in my markdown.
Any solution for this? I will be appreciated if the script could be provided (if needed).
Thanks.
If those markdown files are located in a java project, you may try spotless.
For example, if you have a maven project, with spotless, just run mvn spotless:apply, it could fix all the styles / formatting issues of your markdown files automatically.

Understanding PDFBox jar files

I am attempting to install PDFBox on my system in order to create PDF files, but am unsure which jar files I need. If I go to https://pdfbox.apache.org/download.cgi
I see command line tools as follows:
pdfbox-app (9.1MB)
preflight-app (9.2MB)
debugger-app (9.0MB)
I also see "Libraries of each subproject" as follows:
pdfbox (2.6MB)
fontbox (1.6MB)
preflight (248KB)
xmpbox (132KB)
pdfbox-tools (77KB)
pdfbox-debugger (245KB)
What is meant by "each subproject"? Is it talking about the command line tools or something different?
I am planning to use java from the command line rather than in an IDE. Does this mean that I just need the Command line tools or do I need the "Libraries of each Subproject" as well? What does the "-app" indicated in the command line tools vs the related libraries?
Is there a page on apache.org that mentions the differences between all of these?
To create PDF files should I be using the preflight and debugger files as well or are those optional?
Summarizing the comments: you want to create a PDF from scratch and access your development over ssh so you can't use an IDE and have to use javac. For that you could use pdfbox-app jar file, but this would be huge. Instead, use the pdfbox, fontbox and commons-log jar files. See also here for additional dependencies if you want to do more advanced stuff (read / render (= convert to image) / decrypt / sign).

How to avoid automatic appended file extensions to directory links when converting to pdf using pandoc?

I'm writing company internal documentation in R markdown and compiling using knitr in Rstudio. I'm trying to add a link pointing to a directory as follows:
[testdir](file:////c:/test/)
(this is following the convention described in here)
When I compile it to html, I get the following link.
testdir
and it works as expected in Internet explorer. However, when I try to convert to pdf straight from RStudio, an unwanted pdf extension is appended to the link. I tried dissecting the problem and it seems this change is happening within pandoc. Here are the details.
When I convert it to latex using pandoc,
>pandoc -f markdown -t latex testing.md -o test.tex
the link in the latex output file looks as follows:
\href{file:///c:/test/}{testdir}
Everything good so far. However, when I convert the latex output to pdf with pandoc,
>pandoc -f latex -t latex -o test.pdf test.tex
a .pdf extension is appended to the link. Here is a copy/paste of the pdf link output:
/c:/test/.pdf
is there a way to avoid this unwanted appended extension?
Perhaps I'm asking too much of pandoc, but I thought it might be worth asking since RStudio is becoming such a useful IDE to write my dynamic documents.
As you said, the .tex file pandoc generates is fine. So the problem is actually with LaTeX, specifically with the hyperref package which is used in pandoc's LaTeX template.
The problem with two possible solutions was described here. To prevent hyperref from being smart and adding a file extensions, try:
[testdir](file:///c:/test/.)
Or use ConTeXt instead of LaTeX:
$ pandoc -t context -s testing.md -o test.tex && context test.tex

Macro expansion in rpm spec files and ltib

I am pulling my hair out over an issue I am having with building rpms through LTIB. I am trying to write my own spec file and for some reason It seems as though simple macros I have defined will not expand within the %Files section.
For example, at the top of my spec file I have the following:
%define myfilepath %{pfx}/lib/python%{pyver}/site-packages/wx-2.8-gtk2-unicode/
and my %Files section looks like this:
%Files
%defattr(-,root,root)
%{myfilepath}
Yet when I run ./ltib -m scdeploy -p I get the following error
RPM build errors:
File must begin with "/": %{myfilepath}
Build time for wxPython: 0 seconds
Is there something I'm missing? Nowhere in the documentation do I see that macros are dissallowed in the %Files section. predefined macros seem to expand fine within the %files section but any macro I have defined with %define in the header of my spec file acts as though its undefined when I am running ltib with the scdeploy option. Macros all work as expected when executing ltib withprep, scbuild and scinstall modes.
Edit: Using ltib version 9.1.1, rpmbuild version 4.0.4
Managed to figure it out after looking at the ltib source. It turns out ltib fabricates a spec file when running in scdeploy mode. This fabricated spec file only preserves the contents of the %files section in the spec file you wrote so the header and all of the macros you defined there are lost.
Not sure why LTIB behaves this way for scdeploy and not sbuild, scinstall, etc. I have a question out to the LTIB mailing list.

How to add a changelog to an RPM created with CPack

In a typical spec file there is a changelog section. I now use CPack and was wondering how to add such a section. I can't find information about that on the web.
Could I use an external file and indicate it to CPack for example ?
If you pack a RPM file use CPACK_RPM_CHANGELOG_FILE
May be used to embed a changelog in the spec file. The refered file will be read and directly put after the %changelog section.