# How to put quotation marks above and below letters d and p

I want to put quotation marks (and apostrophe) above and bellow letters p and d. This is what i want: Example

As you can see, the crossed letters are the correct ones, so it would be amazing if there is a way to label it, either with a crossed line (like in the image) or with a number.

Thanks in advance.

• Are you aware of the cancel package? – marmot Nov 13 '17 at 3:47
• Welcome to TeX.SX. When you post a question, you are expected to provide a "Minimal Working Example" (MWE) that starts with \documentclass, includes all relevant \usepackage commands, ends with \end{document} and compiles without errors, even if it does not produce your desired output. I suggest you start by reading about the \overset and \underset commands, as well as the cancel package. – Sandy G Nov 13 '17 at 5:37
• I can see a small image with 14 lines and many things on each line, but i have absolutely no idea what you are asking about. – Johannes_B Nov 13 '17 at 6:05
• those aren't really "quotation marks". they are combining diacritics, unicode 030D, 030E, 0329 and 0348. and they are placed at a uniform height or depth regardless of the shape of the embellished letter or presence of cancellation. they don't all seem to be supported by tipa; i'm looking for other possibilities. – barbara beeton Nov 13 '17 at 16:31

## 3 Answers

This approach could meet your expectations

The code

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{centernot}
\usepackage{textcomp}
\usepackage{amsmath}

\newcommand{\myoverset}[2]{%
\mathop{#2}\limits^{\vbox to -.1ex{%
\kern -0.6ex\hbox{$\scriptstyle #1$}\vss}}}

\newcommand{\myunderset}[2]{%
\mathop{#2}\limits_{\vbox to -.1ex{%
\kern -1.2ex\hbox{$\scriptstyle #1$}\vss}}}

\newcommand\can[1]{\kern0.1em\centernot{#1}\kern0.1em}  % Cancel command
\newcommand{\vc}[3]{\myoverset{#2}{\myunderset{#3}{\text{#1}}}} % Main environment (acc:=accent command)
\newcommand{\sq}{\text{\text\textquotesingle}} % sq:=single quote
\newcommand{\dq}{\text{\text\textquotedbl}}  % dq:=double quote

\begin{document}

\begin{center}
\textbf{Normal versions}

$\acc{p}{\sq}{} \acc{p}{\dq}{} \acc{p}{}{\sq} \acc{p}{}{\dq} \acc{d}{\sq}{} \acc{d}{\dq}{} \acc{d}{}{\sq} \acc{d}{}{\dq}$

$\acc{p}{\sq}{\sq} \acc{p}{\dq}{\sq} \acc{p}{\sq}{\dq} \acc{p}{\dq}{\dq} \acc{d}{\sq}{\sq} \acc{d}{\dq}{\sq} \acc{d}{\sq}{\dq} \acc{d}{\dq}{\dq}$

\textbf{Cancelled versions}

$\can{\acc{p}{\sq}{}} \can{\acc{p}{\dq}{}} \can{\acc{p}{}{\sq}} \can{\acc{p}{}{\dq}} \can{\acc{d}{\sq}{}} \can{\acc{d}{\dq}{}} \can{\acc{d}{}{\sq}} \can{\acc{d}{}{\dq}}$

$\can{\acc{p}{\sq}{\sq}} \can{\acc{p}{\dq}{\sq}} \can{\acc{p}{\sq}{\dq}} \can{\acc{p}{\dq}{\dq}} \can{\acc{d}{\sq}{\sq}} \can{\acc{d}{\dq}{\sq}} \can{\acc{d}{\sq}{\dq}} \can{\acc{d}{\dq}{\dq}}$
\end{center}

\end{document}


EDIT

I considered @Mico's suggestions and changed the commands \oversetand \underset to \myoversetand \myunderset, respectively. Also edited instruction \texttt{} inside definition of the main new environment.

• I don't think you need to "wrap" \texttt inside \text. \texttt{...} should suffice. A separate thought: Repurposing the macro names \overset and \underset may cause problems in a document in which the "original" forms of the macros are used. – Mico Nov 13 '17 at 11:41
• @Cragfelt Thank you so much! It was really helpful. – Juan Duarte Nov 13 '17 at 15:53
• @Mico Thank you for your suggestions. I have made some changes in my code according to them. I appreciate it. – Cragfelt Nov 15 '17 at 22:21
• @JuanDuarte You are welcome. I am glad it helped you. – Cragfelt Nov 15 '17 at 22:36

Or with stackengine:

\documentclass{article}
\usepackage[T1]{fontenc}  % access \textquotedbl
\usepackage{textcomp}     % access \textquotesingle
\usepackage{cancel}
\usepackage{stackengine}
\newlength{\dheight}
\newlength{\pdepth}
\newcommand{\abo}[2]{\stackinset{c}{}{c}{8pt}{#1}{\mbox{\vline height \dheight depth \pdepth width 0pt #2}}}
\newcommand{\bel}[2]{\stackinset{c}{}{c}{-10pt}{#1}{\mbox{\vline height 10pt depth \pdepth width 0pt #2}}}

\begin{document}
Normal text:
\settowidth{\dheight}{\heightof{d}}
\settowidth{\pdepth}{\depthof{p}}
\abo{'}{d}
\abo{\textquotedblright}{d}
\abo{'}{p}
\abo{\textquotedblright}{p}
\bel{'}{d}
\bel{\textquotedblright}{d}
\bel{'}{p}
\bel{\textquotedblright}{p}
\cancel{\abo{'}{d}}
\cancel{\abo{\textquotedblright}{d}}
\cancel{\abo{'}{p}}
\cancel{\abo{\textquotedblright}{p}}
\cancel{\bel{'}{d}}
\cancel{\bel{\textquotedblright}{d}}
\cancel{\bel{'}{p}}
\cancel{\bel{\textquotedblright}{p}}

\ttfamily
ttfamily:
\settowidth{\dheight}{\heightof{d}}
\settowidth{\pdepth}{\depthof{p}}
\abo{\textquotesingle}{d}
\abo{"}{d}
\abo{\textquotesingle}{p}
\abo{"}{p}
\bel{\textquotesingle}{d}
\bel{"}{d}
\bel{\textquotesingle}{p}
\bel{"}{p}
\cancel{\abo{\textquotesingle}{d}}
\cancel{\abo{"}{d}}
\cancel{\abo{\textquotesingle}{p}}
\cancel{\abo{"}{p}}
\cancel{\bel{\textquotesingle}{d}}
\cancel{\bel{"}{d}}
\cancel{\bel{\textquotesingle}{p}}
\cancel{\bel{"}{p}}

\sffamily
sffamily:
\settowidth{\dheight}{\heightof{d}}
\settowidth{\pdepth}{\depthof{p}}
\abo{'}{d}
\abo{"}{d}
\abo{'}{p}
\abo{"}{p}
\bel{'}{d}
\bel{"}{d}
\bel{'}{p}
\bel{"}{p}
\cancel{\abo{'}{d}}
\cancel{\abo{"}{d}}
\cancel{\abo{'}{p}}
\cancel{\abo{"}{p}}
\cancel{\bel{'}{d}}
\cancel{\bel{"}{d}}
\cancel{\bel{'}{p}}
\cancel{\bel{"}{p}}

\end{document}


• @JuanDuarte You're welcome, thank you for accepting my answer! – CarLaTeX Nov 13 '17 at 15:11

Something like this? (The screeshot you posted isn't exactly easy to decipher...)

\documentclass{article}
\usepackage[T1]{fontenc}  % access \textquotedbl
\usepackage{textcomp}     % access \textquotesingle
\usepackage{amsmath}      % for "\text" macro
\usepackage{accents}      % for "\accentset" and "\underaccent" macros

\def\dsquoteup{$\accentset{\text{\textquotesingle}}{\text{d}}$}
\def\ddquoteup{$\accentset{\text{\textquotedbl}}{\text{d}}$}
\def\psquoteup{$\accentset{\text{\textquotesingle}}{\text{p}}$}
\def\pdquoteup{$\accentset{\text{\textquotedbl}}{\text{p}}$}
\def\dsquotedn{$\underaccent{\text{\textquotesingle}}{\text{d}}$}
\def\ddquotedn{$\underaccent{\text{\textquotedbl}}{\text{d}}$}
\def\psquotedn{$\underaccent{\text{\textquotesingle}}{\text{p}}$}
\def\pdquotedn{$\underaccent{\text{\textquotedbl}}{\text{p}}$}

\begin{document}
\ttfamily
\dsquoteup\ddquoteup\psquoteup\pdquoteup \dsquotedn\ddquotedn\psquotedn\pdquotedn

\sffamily
\dsquoteup\ddquoteup\psquoteup\pdquoteup \dsquotedn\ddquotedn\psquotedn\pdquotedn
\end{document}