How do we use the --pdf flag for generating documentation? - kframework

The video tutorial in http://www.kframework.org/index.php/Lesson_4,_LAMBDA:_Generating_Documentation;_Latex_Attributes suggests that we should use kompile lambda --pdf, but when I run it I got the following error:
[Error] Critical: Unknown option: --pdf (Unknown option: --pdf)
The kdoc --help option also result in a Command 'kdoc' not found error.
How do I correctly use this option to generate the formatted K definition?

The kdoc functionality (and --pdf) has not worked for quite some time.
If you want LaTeX ASTs output for given individual terms, you can use --output latex for any of kast, krun, or kprove. Unfortunately this does not work for entire definitions yet, and will not auto-format for you (it only outputs an AST, you'll still need to tell LaTeX how to render the nodes in said AST).

Related

Change resolution of converted images using Sphinx ImageMagick extension sphinx.ext.imgconverter

We are using Python-Sphinx to build our end user manuals.
In order to automatically convert our assorted graphic file formats like we are using the Sphinx Extension sphinx.ext.imgconverter, which utilizes ImageMagick to convert our graphic file formats to graphic formats, which the given build target can understand.
For detailed information see: sphinx.ext.imgconverter
Unfortunately, the output of the converted images does not satisfy our needs. A main issue is the low resolution of the converted images, which gives pixelated outcomes.
Therefore I included the following line to my conf.py:
image_converter_args=["-density 300"]
Now, the build process fails and leaves me with the following error message.
Extension error:
convert exited with error:
[stderr]
magick.exe: unrecognized option `-density 300' at CLI arg 1 # fatal/magick-cli.c/ProcessCommandOptions/428.
Can someone please help me?
The arguments should be a list.
image_converter_args=["-density", "300"]
Where "-density" is the operator argument, and "300" is the value argument.

Bazel Checkers Support

What options do Bazel provide for creating new or extending existing targets that call C/C++-code checkers such as
qac
cppcheck
iwyu
?
Do I need to use a genrule or is there some other target rule for that?
Is https://bazel.build/versions/master/docs/be/extra-actions.html my only viable choice here?
In security critical software industries, such as aviation and automotive, it's very common to use the results of these calls to collect so called "metric reports".
In these cases, calls to such linters must have outputs that are further processed by the build actions of these metric report collectors. In such cases, I cannot find a useful way of reusing Bazel's "extra-actions". Ideas any one?
I've written something which uses extra actions to generate a compile_commands.json file used by clang-tidy and other tools, and I'd like to do the same kind of thing for iwyu when I get around to it. I haven't used those other tools, but I assume they fit the same pattern too.
The basic idea is to run an extra action which generates some output for each file (aka C/C++ compilation command), and then find all the output files afterwards (outside of Bazel) and aggregate them. A reasonably complete example is here for reference. Basically, the action listener (written in Python) decodes the extra action proto and extracts the source files, compiler options, etc:
action = extra_actions_base_pb2.ExtraActionInfo()
with open(argv[1], 'rb') as f:
action.MergeFromString(f.read())
cpp_compile_info = action.Extensions[extra_actions_base_pb2.CppCompileInfo.cpp_compile_info]
compiler = cpp_compile_info.tool
options = ' '.join(cpp_compile_info.compiler_option)
source = cpp_compile_info.source_file
output = cpp_compile_info.output_file
print('%s %s -c %s -o %s' % (compiler, options, source, output))
If you give the extra action an output template, then it can write that output to a file. If you give the output files distinctive names, you can find them all in the output tree and merge them together however you want.
A more sophisticated option is to use bazel query --output=proto and write code to calculate the extra action output filenames of the targets you're interested in from there. That requires writing more code, but you don't have problems with old output files in the output tree that are accidentally included when aggregating.
FWIW, Aspects are another possibility. However, I think extra actions work acceptably for this.

Lua syntax highlighting latex for arXiv

I have a latex file which needed to include snippets of Lua code (for display, not execution), so I used the minted package. It requires latex to be run with the latex -shell-escape flag.
I am trying to upload a PDF submission to arXiv. The site requires these to be submitted as .tex, .sty and .bbl, which they will automatically compile to PDF from latex. When I tried to submit to arXiv, I learned that there was no way for them to activate the -shell-escape flag.
So I was wondering if any of you knew a way to highlight Lua code in latex without the -shell-escape flag. I tried the listings package, but I can't get it to work for Lua on my Ubuntu computer.
You can set whichever style you want inline using listings. It's predefined Lua language has all the keywords and associated styles identified, so you can just change it to suit your needs:
\documentclass{article}
\usepackage{listings,xcolor}
\lstdefinestyle{lua}{
language=[5.1]Lua,
basicstyle=\ttfamily,
keywordstyle=\color{magenta},
stringstyle=\color{blue},
commentstyle=\color{black!50}
}
\begin{document}
\begin{lstlisting}[style=lua]
-- defines a factorial function
function fact (n)
if n == 0 then
return 1
else
return n * fact(n-1)
end
end
print("enter a number:")
a = io.read("*number") -- read a number
print(fact(a))
\end{lstlisting}
\end{document}
Okay so lhf found a good solution by suggesting the GNU source-hightlight package. I basically took out each snippet of lua code from the latex file, put it into an appropriately named [snippet].lua file and ran the following on it to generate a [snippet]-lua.tex :
source-highlight -s lua -f latex -i [snippet].lua -o [snippet]-lua.tex
And then I included each such file into the main latex file using :
\input{[snippet]-lua}
The result really isn't as nice as that of the minted package, but I am tired of trying to convince the arXiv admin to support minted...

Latex to PDF error unknown float option 'H' Doxygen

I'm attempting to convert latex to pdf, using doxygen generated latex files. I am using Doxygen 1.8.7. However, I keep getting this error:
!LaTex Error: Unknown float option 'H'.
...
1.6 \begin<figure>[H]
I've narrowed it down to a .tex file, which contains the following:
\hypertarget{group___a_m_s___common}{\section{A\+M\+S\+\_\+\+Common}
\label{group___a_m_s___common}\index{A\+M\+S\+\_\+\+Common#{A\+M\+S\+\_\+\+Common}}
}
Collaboration diagram for A\+M\+S\+\_\+\+Common\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=334pt]{group___a_m_s___common}
\end{center}
\end{figure}
\subsection*{Modules}
\begin{DoxyCompactItemize}
\item
\hyperlink{group___common___error___codes}{A\+M\+S Common Error Codes}
\end{DoxyCompactItemize}
\subsection{Detailed Description}
Where do I go from here? Am I right in saying that it's looking for an image that it can't find?
This does indeed seem to be an issue with the float package. I had the same problem. However, just adding EXTRA_PACKAGES=float didn't fix it for me. I finally found this page which describes a conflict between the fixltx2e package and the float package which generates this error about the unknown H option. So, I commented out line 11 where it says \usepackage{fixltx2e} in the doxygen generated tex file (called refman.tex for me). Then it converted to pdf without any further problems.
As the latex error says, it's not looping for an image it can't find, but rather encountered an option to a floating element it doesn't understand. The 'H' option for float placement forces a figure to appear exactly at the place it appears in the latex code and essentially not to float. It requires the "float" package.
Thus in order to get your code working, add the following to the preamble:
\usepackage{float}
I'm not sure how to tell Doxygen that this package is required so as to not have to touch the automatically generated latex files..
In fact according to the doxygen documentation here adding the following to your configuration file should do the trick:
EXTRA_PACKAGES=float
There's a discussion on the 'H' option over here and a rather detailed discussion on latex float placement in general here.

How to include .iuml path to generate PlantUML diagram in Doxygen

I'm working on the documentation of a component using Doxygen and I want to include UMLdiagrams in between the text.
I know how to do most of it, as I simply need to copy the .tuml source into my .dox file and run doxygen. However, one of my diagrams is a class diagram that includes other .iuml files, like explained in the PlantUML site.
So, basically, I do:
#mainpage main_page MyDoxygen
\
...
\
#startuml
\
!include iuml_files/Class01.iuml
!include iuml_files/Class02.iuml
\
MainClass <|-- Class01
MainClass <|-- Class02
\
#enduml
Long story short, I don't know how to make Doxygen understand it must look for the .iuml files in the directory (relative path) I'm giving as argument to the include directive.
If I wasn't clear enough as to what I need, please let me know and I will try make it clearer.
Can I please get some help?
I had a similar problem (I own the Word Add-in for plantuml)
You can specify the java property "plantuml.include.path" in the command line :
java -Dplantuml.include.path="c:/mydir" -jar plantuml.jar atest1.txt
(see http://plantuml.sourceforge.net/preprocessing.html)
I expect it'll work when you modify the batch file for calling Plantuml
http://plantuml.sourceforge.net/doxygen.html
I had a similar request for my Word Addin for Plantuml and here it worked.
The Real Answer
Use the PLANTUML_INCLUDE_PATH = ./someRelativeDir configuration, visible in the Doxygen wizard's DOT panel.
The include path is relative to your Doxygen config, ie the starting directory from which the doxygen config is taken.
A Red Herring
I'm leaving the rest of this answer here in case anyone found it previously.
I wrongly reported a bug because I needed new reading glasses and didn't notice a stray character in my path.
This was resolved as not a Doxygen bug
For any interested parties, this is what I saw.
Running PlantUML on generated file /Users/andydent/dev/touchgramdesign/doxygeneratedTG4IM/html/inline_umlgraph_1.pu
Preprocessor Error: Cannot include /Users/andydent/dev/touchgramdesign/doxygeneratedTG4IM/html/handDrawnStyle.iuml
Error line 2 in file: /Users/andydent/dev/touchgramdesign/doxygeneratedTG4IM/html/inline_umlgraph_1.pu
Some diagram description contains errors
error: Problems running PlantUML. Verify that the command 'java -jar "/Library/Java/Extensions/plantuml.jar" -h' works from the command line. Exit code: 1
This is using the configuration setting
PLANTUML_INCLUDE_PATH = ./iumltToCopy
Sharper eyes than mine (at the time) noticed the extra character in the path iuml t ToCopy