Is it possible to use `xxx` to define stem formulas in AsciiDoctor? - asciidoc

I would like to redefine the backticks so that I can use them to type formulas in AsciiDoctor documents. For example, instead of typing
stem:[my formula]
I would like to type just
`my formula`
How can this be done?

As far as I know this is not possible. You have to tell ascidoc(tor) what you want. So you need the usual steps:
activate stem support with :stem:
write your equation either inline or as a block
See more details and examples here: https://asciidoctor.org/docs/user-manual/#activating-stem-support

Related

Is there a way to source only a specified portion of SPSS syntax from another SPSS syntax file?

Is there a way to source only a specified portion of SPSS syntax from another SPSS syntax file? I know about insert but was wondering if there was some code to specify running certain sections of a syntax file, not the whole thing.
you could divide your "other" syntax into relevant portions, and turn each portion into a macro. For example:
define Syn_Por_1 ()
compute a=1.
compute b=2.
!enddefine.
define Syn_Por_2 ()
compute c=mean(a,b).
compute d=c/2.
!enddefine.
Now you can insert the whole syntax, but that would not actually do anything but define the macros. After that you'll be able to run portions of the syntax by calling the relevant macros. For example:
.....
Syn_Por_1.
.....
Syn_Por_2.
.....
As Eli said, there is no way to have INSERT only run a portion of a file, but the macro or just breaking it into modular pieces would work. For more elaborate subsetting, some Python code along with some markup convention in the file(s) could do the job.

asciidoc - Inline Conditional Inclusion Macros

Is there a way to do inline conditional inclusion macros in AsciiDoc?
I would like to be able to do something like:
The control’s data source property is ifdef::wpf[DataContext] ifdef::web[dataSource] and accepts a collection of view model objects.
Is there a syntax variation that would make something like this possible?
It is possible when using asciidoctor, don't know about they python processor.
As of Here you can see how it is used in the test harness.
On our quest we go...
ifdef::holygrail[There is a holy grail!]
There was much rejoicing.

How do I get a list of all distributions in Mathematica

Is there a way to get all parametric distributions in Mathematica as a list without typing it all?
{NormalDistribution[x,y], UniformDistribution[{x,y}], ExponentialDistribution[x]...}
Thanks!
Try
Names["*Distribution"]
and use this list of symbol to construct what you need. You might want to refer to the help for "ToExpression", "StringJoin".

variable in xpath

I'm writing xquery on eXist.
Usually I use this way to select item in xml:
fn:doc($document_name)/root/a
But now I wants to get the xpath from a string variable:
let $xpath := request:get-parameter("xpath", "")
fn:doc($document_name)/$xpath
Of course it doesn't work.
The only way I found now is using eval:
util:eval(fn:concat("fn:doc($document_name)", $xpath)):)
but i don't want to use eval because it's slow and not safe.
I know there's something like:
fn:doc($document_name)/*[name()='node_name']
but I want to select item via the whole path but not only the name of node
and I also have tried to use node-xpath() but don't know how to use it just like name()
You want to do what the eval() function does, so any solution is going to have the same problems as eval. The other approach you could consider is generating a query and then executing it, but it will have exactly the same problems. If you think it might be safer to restrict the string to a subset of XPath expressions (e.g. with no predicates, or no function calls) then you could try testing for those conditions using simple regular expressions.
despite Michael Kay being right, maybe the functx:dynamic-path() is of some help.
It might be a good intermediate solution sitting between fn:eval and generating the query dynamically.
Hope this helps
Michael

In Sphinx, how can I create a linkable "terminology" section without massive overhead?

I want to create a "terminology" section with definitions for terms that I'm using such that every time I use the terms in this terminology section, a link is created that points to the definition.
Currently, the best I can think up is:
.. |flavor| replace:: `:ref:flavor`
.. _flavor:
flavor
------
blah blah blah
Then later, in the other text I have to do:
''' This is a usage of the word |flavor|.'''
I find the above syntax to be very cumbersome. I know I could use yet another layer of scripting or m4 to auto-generate this syntax, but I'm hoping there's a better way..
Not so different, but you can use:
.. glossary::
This directive must contain a reST definition list with terms and definitions. The definitions will then be referencable with the 'term' role.
:term:
Reference to a term in the glossary. The glossary is created using the glossary directive containing a definition list with terms and definitions. It does not have to be in the same file as the term markup, for example the Python docs have one global glossary in the glossary.rst file.
If you use a term that’s not explained in a glossary, you’ll get a warning during build.
[pasted from official sphinx documentation]

Resources