0

I am trying to write urls for .ru wikipedia. For a number of other reasons, I use \cyrillic and \breakhref as defined in the following script. For urls as http://ru.wikipedia.org/wiki/Елена_Стасова, I am not able to render them with proper cyrillic characters and active link. If you know something about, I welcome your advise.

\documentclass[titlepage,a4paper,12pt]{article}
\usepackage{etex}
\usepackage{bigfoot}
\DeclareNewFootnote{default}
\DeclareNewFootnote{Inter}[alph]  %arabic
\MakeSortedPerPage{Inter}
\usepackage[backend=biber,style=philosophy-modern,sorting=nyt]{biblatex}
\usepackage[T2A,T1]{fontenc} 
\usepackage[utf8]{inputenc} 
\usepackage[titletoc,toc,title]{appendix}
\usepackage{lmodern}         % Enable Latin Modern fonts
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage[american,russian,italian]{babel}
\usepackage{tipa}
\usepackage[babel,italian=guillemets]{csquotes}
\usepackage{enumitem}
\usepackage{ifthen}
\usepackage{float}
\usepackage{datetime}
\usepackage{multirow}
\usepackage{pdfcolparallel}
\usepackage{longtable}
\usepackage{fancyhdr}
\usepackage{hyperref}
\usepackage{hypcap}
\usepackage{color}
\usepackage[tableposition=top,figureposition=bottom,font=small,format=hang]{
caption}
\usepackage[object=vectorian]{pgfornament}
\usepackage[normalem]{ulem}
\usepackage{soul}
\newcommand\cyrillic{%
\renewcommand\rmdefault{wncyr}%
\renewcommand\sfdefault{wncyss}%
\renewcommand\encodingdefault{T2A}%
\normalfont
\selectfont}
\makeatletter
\newcommand*{\breakhref}{}
\DeclareRobustCommand*{\breakhref}{%
  \begingroup
  \hyper@normalise\breakhref@
}
\newcommand*{\breakhref@}[2]{%
  \endgroup
  \SOUL@setup
  \def\SOUL@everyspace##1{%
    ##1%
    \dimen@=\fontdimen2\font
    \advance\dimen@ by \fontdimen3\font
    \cleaders\hbox to \dimen@{%
      \hss
      \href{#1}{\ \vphantom{#2}}%
      \hss
    }\hskip\dimen@\relax
    \hspace{-\fontdimen3\font
        plus \fontdimen3\font minus \fontdimen3\font}%
  }%
  \def\SOUL@everysyllable{%
    \href{#1}{\the\SOUL@syllable\vphantom{#2}}%
  }%
  \def\SOUL@everyhyphen{%
    \discretionary{-}{}{}%
  }%
  \def\SOUL@everyexhyphen##1{%
    \SOUL@setkern\SOUL@hyphkern
    \href{#1}{##1\vphantom{#2}}%
    \discretionary{}{}{%
      \SOUL@setkern\SOUL@charkern
    }%
  }%
  \SOUL@{#2}%
}
\makeatother
\author{mario \\ v. 0.1}
\title{Test}
 \date{\today{,} \currenttime}
 \begin{document}
\maketitle
\begin{abstract}
\end{abstract}\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyhead[LO,RE]{{\footnotesize  Draft Compilation: \today{,}
\currenttime{.}}}
\fancyhead[RO,LE]{\thepage\ } 

\breakhref{http://ru.wikipedia.org/wiki/\textcyrillic{Елена{\_}Стасова}}{
http://ru.wikipedia.org/wiki/\textcyrillic{Елена{\_}Стасова}}

\end{document}
0

Thanks to people at TeX Live mailing list, I learn that I need to urlencode the cyrillic string. Also note, to get the coded url, you just need to cut&paste from Firefox (and maybe other browsers too).

So for https://ru.wikipedia.org/wiki/Большой_террор, the following works nicely:

{\breakhref{https://ru.wikipedia.org/wiki/%D0%91%D0%BE%D0%BB%D1%8C%D1%88%D0%BE%D0%B9_%D1%82%D0%B5%D1%80%D1%80%D0%BE%D1%80}{https://ru.wikipedia.org/wiki/{\textcyrillic{Большой\_террор}}}}

Note, it seems we need to enclose the \textcyrillic within {}.

Indeed, you may check the same trick if you try to insert the above url as a url in this message itself: try to insert url as a link in this post.

Hope it helps

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.