1
\documentclass[12pt,a4paper]{article}
\usepackage{cmap}
\usepackage[utf8]{inputenc}
\usepackage[magyar]{babel}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[document]{ragged2e}
\usepackage[normalem]{ulem}
\usepackage{array}
\usepackage{gensymb}
\usepackage[T1]{fontenc}
\usepackage{accents}
\begin{document}
\newcommand{\genericmathaccentii}[2]{%
  \genericmathaccent{#1{}\mkern3mu#1{}}{#2}%
}
\newcommand{\genericmathaccent}[2]{%
  \vbox{\offinterlineskip\ialign{%
    ##\cr
    \hidewidth$\scriptstyle#1$\hidewidth\cr
    \noalign{\kern-.5ex}
    $#2$\cr}%
  }%
}
\newcommand{\acuteddot}[1]{\genericmathaccentii{\acute}{#1}}
\begin{flushleft}
\sloppy
\justify
$a_{\acuteddot{x}}$
\end{flushleft}
\end{document}

This code is working fine. But if I use $\acuteddot{x}$ in index e.g: $a_{\acuteddot{x}}$ it does not resize itself. But if I use $a_{d}$ it resize itself. How could I do that, to resize itseft like ordinary stuffs. This special character could be anywhere, it could be subscript's subscript.

I am using: MiKTeX, texmaker, win10 64bit

3
  • 1
    Please, can you add a full compilable code instead of a fragment? What packages do you use?
    – Sebastiano
    Commented Feb 21, 2021 at 20:29
  • 1
    I have just edited my post
    – taiwan12
    Commented Feb 21, 2021 at 20:40
  • Now I am using \DeclareRobustCommand{\acuteddot}[1]{\genericmathaccentii{\acute}{#1}} but it still not resize
    – taiwan12
    Commented Feb 21, 2021 at 21:07

2 Answers 2

1

If what you want is the Humgarian double-acute accent, in PDFTeX, it’s in the T1 font encoding. (Edit: or in OT1, which is already loaded by default, although I believe some packages might change that.) You can declare it as a math-mode accent:

\documentclass[12pt,a4paper]{article}
\usepackage{cmap}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[magyar]{babel}
\usepackage{graphicx}
\usepackage{amsmath,amssymb}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[document]{ragged2e}
\usepackage[normalem]{ulem}
\usepackage{array}
\usepackage{gensymb}
\usepackage{bm}
%\usepackage{accents}

\DeclareSymbolFont{t1letters}{T1}{\rmdefault}{m}{it}
\SetSymbolFont{t1letters}{bold}{T1}{\rmdefault}{b}{it}
\DeclareMathAccent{\mathdacute}{\mathalpha}{t1letters}{"05}

\begin{document}
\begin{flushleft}
\sloppy
\justify
$a_{\mathdacute{\alpha}_{\mathdacute{x}}} \boldsymbol{\mathdacute{u}}$
\end{flushleft}
\end{document}

Computer Modern sample

If you don’t like the placement of the accents, \skew it.

This uses up one of the sixteen math alphabets you’re allowed in classic TeX. If you don’t need uppercase Greek in \mathrm, you could instead redefine that to use T1 encoding.

If you can upgrade to LuaLaTeX or XeLaTeX and use Unicode, that will be a more robust solution.

If you are looking for a generic macro to typeset two arbitrary accents side-by-side above a symbol, you could use \text to get a scaling box, or \mathchoice to select the appropriate math style within the box.

2
  • 1
    I don't really see the need for a symbol font. \DeclareMathAccent{\mathdacute}{\mathalpha}{operators}{"7D} is enough, isn't it?
    – campa
    Commented Feb 22, 2021 at 8:32
  • It’s also in OT1, and by default operators is set to that. I believe there are packages that change it, however.
    – Davislor
    Commented Feb 22, 2021 at 14:53
1

No need to define new symbol fonts, because the long umlaut is available in the OT1 encoding.

\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{cmap}
%\usepackage[utf8]{inputenc} % no longer needed
\usepackage[magyar]{babel}

\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}

%\usepackage{amsfonts} % already loaded by amssymb
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{array}
\usepackage{accents}
%\usepackage{gensymb} % do you need it?

\usepackage{graphicx}
%\usepackage[document]{ragged2e} % do you need it?
%\usepackage[normalem]{ulem} % not needed for the example

\DeclareMathAccent{\acuteddot}{\mathalpha}{operators}{125}

\begin{document}

$a_{\acuteddot{x}}+\acuteddot{x}$

\end{document}

enter image description here

I have reorganized your preamble. I'm not sure why using flushleft and then declaring \justify inside it, as justification is the standard typesetting mode.

Where to find the magic number 125? Either consulting a font table or looking into ot1enc.def that has the line

\DeclareTextAccent{\H}{OT1}{125}

and we know that \H is the command for the long umlaut.

Just for completeness, here's how you might define the accent with the manual way you found (and that's not the best definition).

\documentclass[12pt,a4paper]{article}
\usepackage{cmap}
\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc} % no longer needed
\usepackage[magyar]{babel}

\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}

%\usepackage{amsfonts} % already loaded by amssymb
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{array}
\usepackage{accents}
%\usepackage{gensymb} % do you need it?

\usepackage{graphicx}
%\usepackage[document]{ragged2e} % do you need it?
%\usepackage[normalem]{ulem} % not needed for the example

\DeclareMathAccent{\acuteddot}{\mathalpha}{operators}{125}

\makeatletter
\newcommand{\genericmathaccentii}[2]{%
  \genericmathaccent{#1{}\mkern3mu#1{}}{#2}%
}
\newcommand{\genericmathaccent}[2]{%
  \mathpalette\genericmathaccent@{{#1}{#2}}%
}
\newcommand{\genericmathaccent@}[2]{%
  \genericmathaccent@@#1#2%
}
\newcommand{\genericmathaccent@@}[3]{%
  \vbox{\offinterlineskip
    \sbox\z@{$#1#3$}%
    \ialign{%
      ##\cr
      \hidewidth$\m@th#1#2{}$\hidewidth\cr
      \noalign{\kern-\ht\z@}
      $\m@th#1#3$\cr}%
  }%
}
\newcommand{\demotestyle@}[1]{%
  \ifx#1\displaystyle\scriptstyle\else
  \ifx#1\textstyle\scriptstyle\else
  \scriptscriptstyle\fi\fi
}
\makeatletter

\newcommand{\acuteddotalt}[1]{\genericmathaccentii{\acute}{#1}}

\begin{document}

$a_{\acuteddot{x}}+\acuteddot{x}$

$a_{\acuteddotalt{x}}+\acuteddotalt{x}$

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .