2

I would like to cross a symbol like p, in math mode, similar to what we get for h by using \hbar, i.e. (U+A751).

Picture in case of font problems:

enter image description here

  • How about $\not\! p$? – azetina May 12 '16 at 23:39
  • 1
    What do you mean by "It should be clear where the cross should go on p"? \hbar has the [bar] running across the top due to the ascender in h. Should the [bar] run across the bottom in a p due to the descender? – Werner May 12 '16 at 23:41
  • @Werner yes i think the OP must surely be picturing a p with a stroke through the vertical line, much as with ħ, or in other words, like ƀ reflected in the baseline. Here it is: U+A751 – Au101 May 13 '16 at 0:02
  • @Werner, yes, that is what I want. – passerby51 May 13 '16 at 1:21
  • @azetina, this gives a diagonal cross over the whole symbol. I want a horizontal line across the bottom as in Au101 comment. – passerby51 May 13 '16 at 1:23
3

Something similar has been defined by @egreg in this post. But here is a customized command:

\newcommand{\pbar}{\lower1.5ex\hbox{$\mathchar'26$}\mkern-6mu p}

Here is mwe:

enter image description here

\documentclass{article}
\newcommand{\pbar}{\lower1.5ex\hbox{$\mathchar'26$}\mkern-6mu p}
\begin{document}
$\pbar$ {\large$\pbar$} {\huge$\pbar$}
\end{document}

Here is another take at the symbol. The extra horizontal space can be addressed with a \!. The vertical space has been accounted for by keeping the original height and setting the depth to 0pt.

\newcommand{\pbar}{\raisebox{-1.5ex}[\height][0pt]{$\mathchar'26$}\mkern-6mu p}
  • thanks. This seems good. A minor issue is that there is extra space before the symbol. Try for example \log \pbar. – passerby51 May 13 '16 at 16:36
  • Also, extra space below it seems: Try \frac{\log \pbar}{n} – passerby51 May 13 '16 at 16:45
  • @passerby51 See the updated code. Alternatively there exists the \smash command. – azetina May 13 '16 at 17:23
3

The symbol has a Unicode code point:

U+A751 LATIN SMALL LETTER P WITH STROKE THROUGH DESCENDER

There are some (at least) text fonts, which do provide the symbol. Example for LuaTeX/XeTeX:

\documentclass{article}
\usepackage{booktabs}
\usepackage{fontspec}
\newfontfamily\DejaVuSans{DejaVu Sans}
\newcommand*{\Rows}{}
\makeatletter
\newcommand*{\TestFamily}[1]{%
  \expandafter\newfontfamily\csname FONT@#1\endcsname{#1}%
  \g@addto@macro\Rows{\RowFamily{#1}}%
}
\newcommand*{\TestSingle}[1]{%
  \expandafter\newfontfamily\csname FONT@#1\endcsname{#1}%
  \g@addto@macro\Rows{\RowSingle{#1}}%
}
\newcommand*{\RowFamily}[1]{%
  #1 & \csname FONT@#1\endcsname\symbol{"A751}
     & \csname FONT@#1\endcsname\bfseries\symbol{"A751}
     & \csname FONT@#1\endcsname\itshape\symbol{"A751}
     & \csname FONT@#1\endcsname\bfseries\itshape\symbol{"A751}
  \tabularnewline
}
\newcommand*{\RowSingle}[1]{%
  #1 & \csname FONT@#1\endcsname\symbol{"A751}
  \tabularnewline
}
\TestFamily{DejaVu Sans}
\TestSingle{Quivira}
\TestFamily{Segoe UI}
\TestFamily{FreeSerif}
\makeatother
\begin{document}
\begin{tabular}{lllll}
  \toprule
  Name & Regular & Bold & Italic & Bold Italic\\
  \midrule
  \Rows
  \bottomrule
\end{tabular}
\end{document}

Result

The symbol could then be used inside math via \text{\symbol{"A751}} (package amstext or amsmath).

  • à propos DejaVu Sans: with current TL2016, LuaTeX 0.95 + luaotfload end up using the Condensed font. Not the case with TL2015 or xelatex. – user4686 May 13 '16 at 18:17
2

The width of the bar is 9mu, so we need such amount of back up.

Here's a version that works also in sub/superscripts and has no spacing issues.

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\DeclareRobustCommand{\pbar}{\mathord{%
  \text{$\m@th\mkern-2mu\raisebox{-1.5ex}[0pt][0pt]{$\mathchar'26$}\mkern-7mu p$}%
}}
\makeatother

\begin{document}
$a\pbar_{\pbar_{\pbar}}\hbar$

$ap$

\end{document}

enter image description here

  • I was working on the horizontal spacing when I saw your post. Great job at addressing the extra spaces. – azetina May 13 '16 at 17:47
  • Can you add this link just as reference to what \m@th does and what it is? tex.stackexchange.com/a/153398/10898 – azetina May 14 '16 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.