TeX - LaTeX Asked by Another User on August 9, 2021
I’d like to create a macro of some sort which produces a vertical bar |
which scales with the height of the object it’s referred to. Using the physics package this works as follows:
eval{pdv{f}{x}}_y
However I’d like to use something like:
pdv{f}{x}eval|_x
pdv{f}{x}eval_x
pdv{f}{x}eval{x}
This is because when I’m writing it comes more natural to write the vertical bar after the derivative. I may use $bigg|$ or $Bigg|$ since most of my expressions have similar heights but I’d like to know if there’s some way to make this work so that it scales.
The point of having a macro eval{...}
is (I guess) to ensure the scaling (which I don't like in general). It would be possible to patch pdv
such that it saves the height of the whole construct in a length register which is later used to build the par, but I don't like and I don't use the physics
package. Furthermore, automatic scaling is in general very dangerous as you see in the following example
[
left.frac{partial f}{partial x}right|_x
left.frac{partial tilde{f}}{partial x}right|_x
]
I believe there is no doubt that the second expression looks appalling.
Honestly, I see no big difference in having something which works as
frac{dy}{dx}eval_x
over the more direct
frac{dy}{dx}biggr|_x
except sparing two keystrokes and making the code IMO less legible (though the latter comment might depend on how my eyes and brain parse LaTeX math). But if your eval
almost always have the same height (say bigg
) then you could define something like this
documentclass{article}
makeatletter
newcommand*{eval}[1][bigg]{%
ifrelaxdetokenize{#1}relax
defnext{mathclose|}%
else
defnext{csnameexpandafter@gobblestring#1rendcsname|}%
fi
next
}
makeatother
begin{document}
[
frac{partial f}{partial x}eval_x quad
aeval[big]_x quad
aeval[]_x quad
frac{partial f}{partial x}eval[Bigg]_x^y
]
end{document}
By default bigg
is used; different sizes can be given as optional parameter.
Correct answer by campa on August 9, 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