jakobandersen/mod

Suggestion minor feature: postParagraph

Closed this issue · 3 comments

Ezbob commented

Currently I cannot find any way to post regular paragraphs to the summary file. This feature would help in making commentary in the summary pdf.

Do you mean inserting a \paragraph{Title} or inserting a piece of arbitrary Latex code? At the moment there are only short-hands for chapter down to subsubsection. There is no simple way of inserting arbitrary code, but using a few undocumented features it is possible :-):

commentNum = 0 
def makeComment(s):
    global commentNum
    texFilename = "out/comment_%d.tex" % commentNum
    commentNum += 1
    with open(texFilename, 'w') as f:
        f.write(s)
        f.write('\n')
    post('summaryInput "%s"' % texFilename)

postSection("Stuff")
makeComment("hello")

postSection("More Stuff")
makeComment("hello again")

The post function inserts a command for the post-processor, as a Bash command (so don't do post("rm -rf /")). A pre-defined post-function is summaryInput f which inserts \input{f} into the summary.

When I find time I will try to write more documentation for the post-processor.

Ezbob commented

Sounds good. I was thinking about inserting pieces of Latex code into the summary pdf. Thanks for your time.

This can be done with post.summaryRaw() (since November 2022, I forgot to close this):

post.summaryRaw(R"\paragraph{blah}")