8

I need to use Slovak ľ once in text and I do not want to use [slovak]{babel}

Is there a command (like \soft{l}) which would produce it?

  • @DavidCarlisle it is almost like l' but has almost no space between, l!' looks better, but not perfect. – Anton Petrunin Apr 06 '17 at 19:32
  • Does your document load the inputenc package with the option utf8, and the fontenc package with the option T1? If so, there should be nothing stopping you from entering the character in question directly, i.e., as ľ, right? – Mico Apr 06 '17 at 19:34
  • @Mico sigh it's been a long day. I'll delete my comments:-) – David Carlisle Apr 06 '17 at 19:42
  • 1
    @AntonPetrunin I extended Mico's answer:-) – David Carlisle Apr 06 '17 at 19:54
  • 1
    I have seen ni some documents something like l\kern-0.035cm\char39\kern-0.03c (you can find a few occurrences online) for ľ and a similar macro for ť. I guess there are more experienced users on this site which would probably be able to say whether this approach is acceptable - and if not why it is bad. – Martin Apr 07 '17 at 05:43

2 Answers2

7

It would be easiest, I think, if you could compile your document using either XeLaTeX or LuaLaTeX. That way, you won't have to deal with the vagaries of competing and conflicting font encodings.

enter image description here

\documentclass{article}
\usepackage{ifluatex,ifxetex}
\ifluatex\else\ifxetex % do nothing special ...
  \else % must be pdftex...
   \usepackage[utf8]{inputenc}
   \usepackage[T1]{fontenc}
\fi\fi
\usepackage{ebgaramond} % font package that works with pdfLaTeX, XeLaTeX, and LuaLaTeX :-)
\begin{document}
l ľ 
\end{document}

enter image description here

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1,T2A]{fontenc}
\DeclareTextCompositeCommand{\v}{OT1}{l}{l\nobreak\hspace{-.1em}'}
\DeclareTextCompositeCommand{\v}{T2A}{l}{l\nobreak\hspace{-.1em}'}
\begin{document}

{\fontencoding{OT1}\selectfont
\v{l} or just  ľ 
}

{\fontencoding{T1}\selectfont
\v{l} or just  ľ 
}

{\fontencoding{T2A}\selectfont
\v{l} or just  ľ 
}


\end{document}
Mico
  • 506,678
  • Thank you, I need to use '\usepackage[T1,T2A]{fontenc}' --- ľ is OK with '\usepackage[T1]{fontenc}', but I got problems elsewhere (I do not really understand this --- sorry for stupid question) – Anton Petrunin Apr 06 '17 at 19:45
  • You could add the \v{l} also works and doesn't need inputenc – David Carlisle Apr 06 '17 at 19:48
  • @DavidCarlisle \v{l} produces l with v over it, while I need l'... – Anton Petrunin Apr 06 '17 at 19:49
  • @AntonPetrunin - I suggest you change the directive to \usepackage[T2A,T1]{fontenc}, i.e., invert the order of the options. – Mico Apr 06 '17 at 19:49
  • @AntonPetrunin no (that was my mistake earlier) ľ and \v{l} will always produce the same thing. in OT1 (and apparently T2A) there is no ľ character so you get the default v accent 9this can be fixed) but T1 does have a ľ so you get that. – David Carlisle Apr 06 '17 at 19:51
  • @Mico If I do so, I get many errors – Anton Petrunin Apr 06 '17 at 19:51
  • @DavidCarlisle How can I make it to use T1 insted of T2A? – Anton Petrunin Apr 06 '17 at 19:52
  • @AntonPetrunin - Is there any chance you could compile your document under either XeLaTeX or LuaLaTeX? Doing so would let you completely bypass the miseries of having to deal with various and sundry font encodings. – Mico Apr 06 '17 at 19:53
  • Thank you very much {\fontencoding{T1}\selectfont \v{l}} works perfectly – Anton Petrunin Apr 06 '17 at 20:10
4

If your default encoding is T2A, you can do like this:

\documentclass{article}
\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}

\DeclareTextSymbolDefault{\softL}{T1}
\DeclareTextSymbolDefault{\softl}{T1}
\DeclareTextCommand{\softL}{T1}{\v{L}}
\DeclareTextCommand{\softl}{T1}{\v{l}}
\DeclareUnicodeCharacter{013D}{\softL}
\DeclareUnicodeCharacter{013E}{\softl}

\begin{document}

Москва \softl{} Москва ľ Москва

Москва \softL{} Москва Ľ Москва

\end{document}

Note that you can input the character directly with Ľ and ľ.

enter image description here

On the other hand, if you use russian-babel (or another language using the Cyrillic script), you can exploit \textlatin for the occasional word with diacritics in the Latin alphabet.

\documentclass{article}
\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}

\begin{document}

Москва \textlatin{\v{l}} Москва \textlatin{ľ} Москва

Москва \textlatin{\v{L}} Москва \textlatin{Ľ} Москва

\end{document}

The output is the same as above.

egreg
  • 1,121,712
  • 1
    uh, but slovak is written using the latin alphabet. never (as far as i know) in cyrillic. so this example looks a bit weird. better ti contrast it with the transliteration of "Gel'fand" (where that "'" would best be a prime, but apostrophe is often used). – barbara beeton Apr 06 '17 at 20:58
  • 1
    @barbarabeeton The T2A encoding contains a copy of the Latin alphabet (no diacritics), which might be misleading. The OP stated in comments to be using T2A – egreg Apr 06 '17 at 21:15