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

Au101
  • 10,278
passerby51
  • 2,395
  • 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 00:02
  • @Werner, yes, that is what I want. – passerby51 May 13 '16 at 01: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 01:23
  • @passerby51 I've edited your post to clarify, feel free to make any further edits as you see fit – Au101 May 13 '16 at 01:36

3 Answers3

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}
azetina
  • 28,884
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).

Heiko Oberdiek
  • 271,626
  • à propos DejaVu Sans: with current TL2016, LuaTeX 0.95 + luaotfload end up using the Condensed font. Not the case with TL2015 or xelatex. –  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

egreg
  • 1,121,712
  • 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? http://tex.stackexchange.com/a/153398/10898 – azetina May 14 '16 at 16:06