I would like to be able to add the symbol "lambda-bar" (see below) into an equation. How can I do this?
6 Answers
As far as I know (confirmed by the Comprehensive list of LaTeX symbols), the only package that provides \lambdabar
is txfonts
(and the derived newtxmath
). Of course changing all document fonts to get that symbol is out of the question (and the lambda is quite different from other fonts, so it's also impossible to import only it).
One can build the symbol similarly to \hbar
:
\documentclass{article}
\newcommand{\lambdabar}{{\mkern0.75mu\mathchar '26\mkern -9.75mu\lambda}}
\begin{document}
$|\lambdabar|$
$|\lambda|$
\end{document}
This exploits the fact that the bar character used is exactly 9mu wide. In the standard definition of \hbar
there is just \mkern-9mu
, but we need to push the bar slightly to the right. (The second line is just to compare the results.)
A different implementation, where the bar is lower.
\documentclass{article}
\makeatletter
\newcommand{\lambdabar}{{\mathchoice
{\smash@bar\textfont\displaystyle{0.25}{1.2}\lambda}
{\smash@bar\textfont\textstyle{0.25}{1.2}\lambda}
{\smash@bar\scriptfont\scriptstyle{0.25}{1.2}\lambda}
{\smash@bar\scriptscriptfont\scriptscriptstyle{0.25}{1.2}\lambda}
}}
\newcommand{\smash@bar}[4]{%
\smash{\rlap{\raisebox{-#3\fontdimen5#10}{$\m@th#2\mkern#4mu\mathchar'26$}}}%
}
\makeatother
\begin{document}
$|\lambdabar|_{\lambdabar_\lambdabar}$
$|\lambda|_{\lambda_\lambda}$
\end{document}
I've left the four parameters to \smash@bar
so that one can fine tune them for different fonts. The variable parameters are the third (amount of shifting down as a fraction of 1ex in the correct font size) and the fourth (amount of shifting right of the bar, in mu units).
-
that bar looks too high. it would look better closer to the middle of the ascender, and maybe even a little bit lower. this symbol is in the stix fonts, but i'm not exactly sure where, since it's identified as a variant of U+0198, not the basic unicode. Feb 2, 2013 at 17:27
-
@barbarabeeton Maybe it's a bit high, but in this way it matches the height if the bar in
\hbar
.– egregFeb 2, 2013 at 17:54 -
1
-
-
1
It's provided by revsymb
in revtex4
. So you could either use the revtex4
class or just \usepackage{revsymb}
and then write $\lambdabar$
. Here's what you get:
This symbol has a unicode with the number U+019B. You may choose some font which supports this symbol and use it as shown below:
% arara: lualatex
\documentclass{article}
\usepackage{fontspec}
\usepackage{mathtools}
\newcommand{\lambdabar}{{\setmainfont{Linux Libertine O}\text{\symbol{"019B}}}}
\begin{document}
%In text \lambdabar, in inline math $\lambdabar$ or in display:
\[|\lambdabar|_{\lambdabar_\lambdabar}\]
\end{document}
In this case I use the stackengine
package to set a \rule
atop a \lambda
. But the key to success in making it work with all the math styles is the \ThisStyle{...\SavedStyle...}
syntax of the scalerel
package, which both allows the glyph components to be set in the proper math style. Additionally, the values \LMpt
and \LMex
are lengths with respective values of 1pt and 1ex, which do scale with the mathstyle (to 0.7 size in \scriptstyle
and 0.5 size in \scriptscriptstyle
).
Thus, in text and display styles, the rule is moved down 2.4pt for the overlap; in script style, it is moved down .7(2.4pt) and in scriptscript style, it is moved down .5(2.4pt). And while the rule length is always a scalable 1\LMex
in length, the kerning and the rule thickness are composites of scalable and unscalable lengths, chosen to give the most aesthetically pleasing look.
Obviously, the stacking gaps, etc. can be modified to suit your taste.
\documentclass{book}
\usepackage{stackengine,scalerel}
\def\lambdabar{\ThisStyle{\ensurestackMath{\stackon[-2.4\LMpt]{%
\SavedStyle\lambda}{\kern-.5pt\kern\LMpt\rule{1\LMex}{.25pt+.15\LMpt}}}}}
\begin{document}
$\lambdabar \scriptstyle\lambdabar \scriptscriptstyle\lambdabar$
\end{document}
I tried all of the above, and this worked the best, for me.
You need to install the tipa
package, and since your \lambdabar
will be in math mode, you must use \mbox{}
to take it back to text mode.
It works with two lines of code, as shown below:
\usepackage{tipa}
\newcommand{\lambdabar}{\mbox{\textipa{\textcrlambda}}}
here is the character, in a math string:
... $\lambdabar$
-
2Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Sep 28, 2014 at 19:11
The answers posted earlier helped me conceptually to develop a solution for the Jupyter/Mathjax environment. I thought I should post that solution for the folks who would like a solution specific to that environment.
Run this first in any cell before invoking lambdabar:
$$\newcommand\lambdabar{
\raise1.5pt{\moveright4.0pt\unicode{0x0335}}\moveleft1pt\lambda
}$$
Then you may use \lambdabar, sample use in markdown with mathjax:
From Krane pg 422 we have also particles of momentum $p$ >interacting with
impact parameter $b$. The semiclassical relative angular >momentum is then
$$ \mathcal{l} \hbar = pb $$ or $$ b = \mathcal{l} \frac{\hbar}{p} = \mathcal{l} \frac{\lambda}>{2\pi}= \mathcal{l}\; \lambdabar $$
Click on the image to see a larger version (didn't realize it would be so small here). That should be reduced Plank constant divided by momentum in the fraction above, but the subject here is really the bar lambda symbol so will leave image as is (but I did correct the LaTex code above).
My system environment running the code is:
Software Version
Python 3.6.3 64bit [MSC v.1900 64 bit (AMD64)]
IPython 6.1.0
OS Windows 8.1 6.3.9600 SP0
numpy 1.13.3
scipy 0.19.1
ipython 6.1.0
JupyterLab v0.27.0
Wed Dec 12 15:41:29 2018 Mountain Standard Time
tipa
provides\textcrlambda
. Found via How to look up a symbol?.