org-babel header arguments refcard - org-mode

Is there a list-like refcard/cheatsheet for org-babel header arguments somewhere?
I know there is the online docs that have them all, but it would be great to have something more like the org-refcard, e.g. one section per argument and one list item per option.

Related

Lisp - Extracting info from a list of comma separated values

I've tried searching this but have yet to find something that suits anything close to my needs. I'm trying to create a Autocad LISP that takes a text file, which is a list of comma-separated values, and place a block at coordinates defined by the list. BUT, only for items on the list where the last entry starts with "HP"
So that's sounds a bit complex, but the text file is basically a UTM survey output, and looks like this:
1000,Easting,Northing,Elevation,Identifier
1001,Easting,Northing,Elevation,Identifier
Etc.
The identifier is a variety of values, but I want to extract the Northing,Easting,Elevation, and insert a block (this last part I've got) at that location when the identifier begins with "HP". The list can be long and the number of HPs can be 1 or 5000. I'm assuming there's a "for x=1:end, do" type of loop than can be made that reuses the same variables over and over.
I'm a newbie to LISP so I'm stuck in that spot between "here are I've-never-programmed-before tutorials to make hello world" and "here is a library of the 3000 different commands in alphabetical order"
I believe the functions you are needing to solve this question are open, read-line or read-char, close,strlen, and substr. The first four functions relate to AutoLisp writing and reading a file. The last two functions manipulate the string variables that were pulled from the file. With them, you can find the "HP" within the text. To loop through the same code, three come to my mind: repeat, while, and foreach.
For a list of variables to quickly reference with their descriptions, here's a good starting point. This particular page has the information broken up by category instead of alphabetical order.
https://help.solidworks.com/2022/English/api/draftsightlispreference/html/lisp_functions_overview.htm
Here are a few tutorials where AutoLisp code is used to write and read other files:
https://www.afralisp.net/autolisp/tutorials/file-handling.php
https://www.afralisp.net/autolisp/tutorials/external-data.php
Lastly, here's an example of AutoLisp writing and reading attributes from and to blocks.
https://github.com/GitHubUser5376/AttributeImportExport
You can use Lee-Mac's Reacd-CSV function to get a list of the csv values.
And for the "HP" detection yes you might have to go through(using loop options mentioned above like while, repeat,foreach) each and use
(substr Identifier 1 2)
to validate

Orgmode, How can I remove codeblock descriptions?

I have an orgmode document with a latex codeblock:
So:
#+BEGIN_SRC latex
Hello
#+END_SRC
But when I generate a pdf, I get:
How can I remove this "Latex" description, and have only "So: Hello" shown?
Thank you!
From the comment, I don't think that org-latex-classes is quite correct. In
particular, the \usepackage* bit doesn't look correct.
The C-h v for that variable states
Alist of LaTeX classes and associated header and structure.
If #+LATEX_CLASS is set in the buffer, use its value and the
associated information. Here is the structure of each cell:
(class-name
header-string
(numbered-section . unnumbered-section)
...)
The header string
-----------------
The HEADER-STRING is the header that will be inserted into the
LaTeX file. It should contain the \documentclass macro, and
anything else that is needed for this setup. To this header, the
following commands will be added:
- Calls to \usepackage for all packages mentioned in the
variables ‘org-latex-default-packages-alist’ and
‘org-latex-packages-alist’. Thus, your header definitions
should avoid to also request these packages.
- Lines specified via "#+LATEX_HEADER:" and
"#+LATEX_HEADER_EXTRA:" keywords.
If you need more control about the sequence in which the header
is built up, or if you want to exclude one of these building
blocks for a particular class, you can use the following
macro-like placeholders.
[DEFAULT-PACKAGES] \usepackage statements for default packages
[NO-DEFAULT-PACKAGES] do not include any of the default packages
[PACKAGES] \usepackage statements for packages
[NO-PACKAGES] do not include the packages
[EXTRA] the stuff from #+LATEX_HEADER(_EXTRA)
[NO-EXTRA] do not include #+LATEX_HEADER(_EXTRA) stuff
So a header like
\documentclass{article}
[NO-DEFAULT-PACKAGES]
[EXTRA]
\providecommand{\alert}[1]{\textbf{#1}}
[PACKAGES]
will omit the default packages, and will include the
#+LATEX_HEADER and #+LATEX_HEADER_EXTRA lines, then have a call
to \providecommand, and then place \usepackage commands based
on the content of ‘org-latex-packages-alist’.
So I don't think you should have that \packages* line in there. Also, you are
better off either using the custom interface to set this variable or put it as a
setq in your init file. I don't think there is any reason to have to load it
inside an eval-after-load call.
Use the org variables mentioned in the docs above to add/remove packages. You
need to be careful with this as I've found this to be one area org-mode can be a
little fragile - there are some package dependencies which kick in differently
depending on whether your exporting a whole org file as latex, part of a
file/tree or a block.

libreoffice calc - varargs in macros

I understand Excel has a TEXTJOINfunction which allows one to display multiple values as a tuple.
I also understand Libre Office does - for whatever reason - not have them.
How do I write an auxiliary macro vec that produces the desired tuple representation for me?
E.g. =vec(A1) should produce ="("&A1&")",
=vec(A1:A3) should produce ="("&A1&","&A2&","&A3&")",
=vec(A1,X5:X99,Z3) should result in ="("&A1&","&"X5"&","&X6&...&x99&","&Z3&")"
etc, etc.
Easy enough a macro to implement in, say, bash, but I would like to just define it once then use it in calc, not constantly copy from console to spreadsheet.
How do I implement this in calc?
According to https://forum.openoffice.org/en/forum/viewtopic.php?f=45&t=67880, it is possible for a Basic function to use a variable number of arguments if it is declared with Option Compatible. This makes it behave more like MS Excel. The argument is declared as ParamArray pa().
The link that #tohuwawohu posted shows most of the implementation details needed.
To do it in a way that is more native to LibreOffice, write a Spreadsheet Add-In with a Java declaration that uses any[] as an argument. For information about add-in argument types, see https://www.openoffice.org/api/docs/common/ref/com/sun/star/sheet/AddIn.html.
The actual function can also be implemented in Java. Or, it can probably be implemented in another language that accepts a variable number of arguments, such as Python *args.

How to create a multi-level ordered (numbered) plain list in org-mode?

In org-mode, if I have an ordered list such as
first item
second item
third item
fourth item
and I demote an item, the demoted item is automatically renumbered restarting from 1:
first item
second item
third item
fourth item
Is there a way to make org-mode (or emacs in general) to automatically renumber demoted items like when using legal numbering?
I mean this:
first item
second item
2.1. third item
2.1.1. fourth item
Org-mode doesn't currently provide this functionality, and nor, to my knowledge, does any existing minor mode. The only emacs package I'm aware of which does is hyperbole, whose koutline module (here is an example-document, exported to html) provides an impressive suite of outline-editing tools, and supports hierarchical legal numbering.
(koutline also supports "klinks" between numbered paragraphs which refer to an invariant ID assigned to each paragraph on creation, so that the links remain valid even if one moves a paragraph from its original position in the document hierarchy.)
Unfortunately koutline is incompatible with org-mode. It does have a rudimentary HTML-export, but this is unlikely, in its present form, to satisfy anyone used to the wide range of export options provided by org-export. Nevertheless, depending on your use-case, koutline might be an adequate tool.
Org-mode's built-in list styles include
unordered lists, using -, + or *,
ordered lists, using 1. or 1), and
definition lists, using :: to separate terms from definitions.
You can cycle a given list between these styles using S-left and S-right.
There are a number of forum posts and mailing list entries asking for legal numbering, but unfortunately I don't think it's supported.
I can create a multi-level lists with:
1. Step 1
1. Substep 1
1. Substep 2
1. Step 2
1. Step 3
When rendered in Gitea, it will use different number systems for the two levels, e.g. "1,2,3" or "i,ii,iii".

show list of options in elisp

HI,
I have the following problem:
Provided a list of values, and using a formatting function passed as argument, display all its elements in a helper buffer. The user would then select one of them using the arrow keys. The returned value must be the chosen entry.
If you have ever used reftex to insert citations, or browse-kill-ring, you know what I'm talking about. Those two examples use custom code to achieve the desired results, but perhaps there is a library that could do that.
(with-output-to-temp-buffer "*Name of buffer*"
(display-completion-list '("foo" "bar" "baz" "qux")))