TeX - LaTeX Asked by user95547 on February 3, 2021
I am only recently learning about the importance of being consistent with markup when typesetting a document in LaTeX (Separate content from formatting – i.e., "just type"). For instance,
emph
is a semantic markup, and not exactly an alternative to textit
: emph or textitvec
for vectors is good practice, not because vectors should be typeset with arrows above them, but because we have the freedom to redefine vec
later on for it to appear as we wish: How to change all vec{} to bf{}dots
commands for use in different semantic contexts: Difference of the dots*Along the same lines, I am now wondering whether it is good to define a custom command, say func
, to be used for markup of functions. For example, would it be better to consistently write something like (func{f}(x), func{g}(x_1, dotsc, x_n))
instead of just (f(x), g(x_1, dotsc, x_n))
?
I searched on this site before posting but could not find any discussion specifically about this aspect. This interesting question is related, but it asks how this can be done rather than if this should be done: How can I influence the spacing of mathematical functions by an own macro?
I have spent years brainstorming about how to make the TeX math syntax more semantic, particularly when it comes to variables and functional expressions. Eventually, my efforts became the package SemanTeX. It has an object-oriented approach to mathematics where each variable belongs to a class, and classes are set up using keyval syntax. You can have a look at the syntax below:
documentclass{article}
usepackage{amsmath,semantex}
NewVariableClassMyVar % creates a new class of variables, called "MyVar"
% Now we create a couple of variables of the class MyVar:
NewObjectMyVarvf{f}
NewObjectMyVarvg{g}
NewObjectMyVarvh{h}
NewObjectMyVarvn{n}
NewObjectMyVarvp{p}
NewObjectMyVarvU{U}
NewObjectMyVarvx{x}
NewObjectMyVarsheafF{mathcal{F}}
% Now we set up the class MyVar:
SetupClassMyVar{
output=MyVar, % This means that the output of an object
% of class MyVar is also of class MyVar
% We add a few keys for use with the class MyVar:
definekeys={ % we define a few keys
{inv}{upper={-1}},
{conj}{command=overline}, % Applies overline to the symbol
{inverseimage}{upper={-1},nopar},
},
definekeys[1]={ % we define keys taking 1 value
{der}{upper={(#1)}},
{stalk}{seplower={#1}},
% "seplower" means "separator + lower", i.e. lower index
% separated from any previous lower index by a separator,
% which by default is a comma
{res}{ rightreturn, symbolputright={|}, lower={#1} },
},
}
begin{document}
$ vf[conj,der=vn] $
$ vg[inv,res=vU]{vx} $
$ vh[inverseimage]{sheafF}[spar,stalk=vp]
= sheafF[stalk=vh{vp}] $
end{document}
Answered by Gaussler on February 3, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP