1

I'm using Texmaker and want to define some custom macros. The macros shall check if a selected letter is uppercase or lowercase and then replace that letter by a sequence defined in the macro. I need this macro to substitute turkish characters

  • \u{g} – ğ
  • \u{G} – Ğ
  • \c{c} – ç
  • \c{C} – Ç
  • \c{s} – ş
  • \c{S} – Ş
  • {\i} – ı
  • \.{I} – İ

but I don't want to manually select the uppercase or lowercase version of the character everytime. I did not find any reference to macros in the texmaker documentation and ixquicking latex uppercase macro turns up results with overly complicated scripts.

I want the macro to work like this: in the text 'Şimşek' I select the 'ş' and by pressing the hotkey assigned to my macro the letter turns into \c{s}. That same macro should turn The 'Ş' into \c{S} when it is selected and the hotkey is pressed.

How what I define a macro to do just that?

cgnieder
  • 66,645
BdN3504
  • 133
  • If you used \usepackage[utf8]{inputenc} you should be able just to type Şimşek and not need \c at all. – David Carlisle Feb 16 '14 at 16:51
  • Thanks for the suggestion but the original text is encoded in iso-8859-1. I tried to change the input encoding to utf-8 but that gave me too many errors i did not want to have to cope with. – BdN3504 Feb 16 '14 at 17:11

1 Answers1

2

I did not fully understand what you are trying to achieve, but you can check whether a string contains a letter, similar to this answer.

\documentclass{article}

\begin{document}

\makeatletter
\def\instring#1#2{TT\fi\begingroup
  \edef\x{\endgroup\noexpand\in@{#1}{#2}}\x\ifin@}
%
\def\isuppercase#1{%
  \instring{#1}{AÂBCÇDEFGĞHIİÎJKLMNOÖÔPRSŞTUÜÛVYZ}%
}%
\makeatother

\if\isuppercase{A}YES\else NO\fi

\if\isuppercase{a}YES\else NO\fi

\end{document}
osolmaz
  • 1,283