2

When I switch main language to russian polyglossia throws this error:

! Package polyglossia Error: The current roman font does not contain the Cyrillic script!
(polyglossia) Please define \cyrillicfont with \newfontfamily.
See the polyglossia package documentation for explanation.

I tried to add:

\newfontfamily\cyrillicfont{Arial}

but it doesn't work.

So how to make it work?

MWE:

\documentclass{article}

\usepackage{xparse}
\usepackage{polyglossia}
\usepackage{fontspec}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{positioning}
\usepackage{tikz-timing}

\NewDocumentEnvironment{mytiming}{smmmmmO{}}{%
    \IfBooleanT {#1}{
    }%
    \begin{pgfonlayer}{background}
        \node [above = 1.5ex of #3, inner sep = 0, outer sep = 0](T1){};
        \node [above = 1.5ex of #5, inner sep = 0, outer sep = 0](T2){};
        \node [above = 0.2ex of T1, inner sep = 0, outer sep = 0](W1){};
        \node [above = 0.2ex of T2, inner sep = 0, outer sep = 0](W2){};
        \draw [help lines] (#2) -- (T1);
        \draw [help lines] (#4) -- (T2);
        \draw [arrows = {Stealth[inset=0pt, angle=30:6pt]-Stealth[inset=0pt, angle=30:6pt]}] (W1) -- node[pos=0.5, below = 0.2ex](){#6}(W2);
}{%
    \end{pgfonlayer}
}
\ExplSyntaxOn
\cs_new:cpn {mytiming*} {\mytiming*}
\cs_new_eq:cN {endmytiming*} \endmytiming
\ExplSyntaxOff

\setotherlanguage[spelling=modern]{russian}
\setotherlanguage[variant=uk]{english}

%\setmainlanguage{english}
\setmainlanguage{russian}

\newfontfamily\cyrillicfont{Arial}

\begin{document}

\begin{tikztimingtable}
    signal              & 5L N(D1) 4H N(D2) 2L N(D3) 4L N(D4) 4L N(D5) 5L \\
    contactor           & 5L N(G1) 4L N(G2) 2H N(G3) 4H N(G4) 4H N(G5) 5L \\
    relay contact       & 5L N(R1) 4L N(R2) 2L N(R3) 4H N(R4) 4H N(R5) 5L \\
                        & 5S N(O1) 4S N(O2) 2S N(O3) 4S N(O4) 4S N(O5) 5S \\
\extracode
\begin{mytiming}{D2}{O2}{R3}{O3}{delay}
    \draw [help lines] (G5) -- (R5);
\end{mytiming}
\end{tikztimingtable}

\end{document}

1 Answer 1

1

You also have to define \cyrillicfontsf and \cyrillicfonttt.

\documentclass{article}

\usepackage{xparse}
\usepackage{polyglossia}
\usepackage{fontspec}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{positioning}
\usepackage{tikz-timing}

\setmainlanguage[spelling=modern]{russian}
\setotherlanguage[variant=uk]{english}

\newfontfamily\cyrillicfont{Arial}
\newfontfamily\cyrillicfontsf{Arial}
\newfontfamily\cyrillicfonttt{cmuntt.otf}

\NewDocumentEnvironment{mytiming}{smmmmmO{}}{%
    \IfBooleanT {#1}{
    }%
    \begin{pgfonlayer}{background}
        \node [above = 1.5ex of #3, inner sep = 0, outer sep = 0](T1){};
        \node [above = 1.5ex of #5, inner sep = 0, outer sep = 0](T2){};
        \node [above = 0.2ex of T1, inner sep = 0, outer sep = 0](W1){};
        \node [above = 0.2ex of T2, inner sep = 0, outer sep = 0](W2){};
        \draw [help lines] (#2) -- (T1);
        \draw [help lines] (#4) -- (T2);
        \draw [arrows = {Stealth[inset=0pt, angle=30:6pt]-Stealth[inset=0pt, angle=30:6pt]}] (W1) -- node[pos=0.5, below = 0.2ex](){#6}(W2);
}{%
    \end{pgfonlayer}
}
\ExplSyntaxOn
\cs_new:cpn {mytiming*} {\mytiming*}
\cs_new_eq:cN {endmytiming*} \endmytiming
\ExplSyntaxOff

\begin{document}

\begin{tikztimingtable}
    signal              & 5L N(D1) 4H N(D2) 2L N(D3) 4L N(D4) 4L N(D5) 5L \\
    contactor           & 5L N(G1) 4L N(G2) 2H N(G3) 4H N(G4) 4H N(G5) 5L \\
    relay contact       & 5L N(R1) 4L N(R2) 2L N(R3) 4H N(R4) 4H N(R5) 5L \\
                        & 5S N(O1) 4S N(O2) 2S N(O3) 4S N(O4) 4S N(O5) 5S \\
\extracode
\begin{mytiming}{D2}{O2}{R3}{O3}{delay}
    \draw [help lines] (G5) -- (R5);
\end{mytiming}
\end{tikztimingtable}

\end{document}

enter image description here

3
  • Thanks @egreg :) It's almost OK. When I write test -- test --- test the - signs aren't changed to and , and maybe others too. What to do to repair it?
    – Simon
    Nov 26, 2019 at 18:33
  • I accept this answer, but need to ask another question because ligatures stopped working in my bigger project because of it and adding [Ligatures=TeX] at the end of \newfontfamily doesn't solve the problem.
    – Simon
    Nov 27, 2019 at 16:34
  • @Simon I guess it's a different issue.
    – egreg
    Nov 27, 2019 at 16:39

You must log in to answer this question.

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