0

My purpose is to write simple commands that put graves and other accents symbols above Greek letters. I am facing the following problem: Let say \grave{i} puts the grave symbol above I (for example: ka\grave{i}). It would be more easy for me not to use { } something like ka\gravei. So my question is: Is it possible to get rid off { } from the definition of a command? (For example \gravearea should output area with a grave on the first letter i.e. a. ) Also, I don't like the use of spaces, like \gravea rea because they divide the words...

  • 1
    Have you tried \grave area? – Werner Oct 30 '15 at 6:42
  • @Werner Thank you for the corrections. Yes I tried! There are many times that I need to put one or more accents in the midlle of a word. So again I have to divide the word. It would much more usefull to not to use space at all! For example I prefer gr\ta\teal (where \t put a vertical accent on the next letter) instead gr\t a\t eal – kornaros Oct 30 '15 at 6:59
  • 3
    latex-community.org/forum/… LaTeX, as a computer program, is dumb as hell and does not know what belongs to the control sequence and what doesn't. A space (or other nonletter) is the only way to mark the end. – Johannes_B Oct 30 '15 at 7:11
  • @kornaros: Short answer. In you example, imagine what would happen if \t, \te, \tea are all macros. How would TeX figure out if you mean gra\t{a}\t{e}al or gra\t{a}\te{a}l or \gra\t{a}\tea{l}? – Aditya Oct 30 '15 at 7:12
  • 1
    If it is only for accents, you can use \'a or the other similar command – Romain Picot Oct 30 '15 at 7:34
4

You can do this if the letter is not a letter. Anytime TeX reads the sequence:

<backslash><valid_nonletter>

(this is in the standard setting; "valid" means basically any printable ASCII character), then TeX interprets it as the control character and executes it, no matter whether a space follows. So you could use for instance:

 gr\7a\7eal

With \7 defined in the preamble by:

\let\7\t

Note that I do not consider this a good idea, but you asked for it. Also, please, do not use anything like this in files you will provide to anybody like journals, publishers, collaborators etc.

  • You are right! I am thinking of developing a new enviroment let say \begin{greekaccents} .....\end{greekaccents} for working locally with these commands. Could you please impove your answer such that \let\7\t works only locally? Also is it possible to have a string of characters like grave as a single "control" character inside the inveroment? – kornaros Oct 30 '15 at 7:53
  • \newenvironment{greekaccents}{\let\7\t}{} -- just hide the \let in the group formed by the environment. Sorry I gotta go, will be back late at night (CET). – yo' Oct 30 '15 at 8:41
  • @kornaros, instead of fighting with weirdly written words due to TeX-speak for accents, just use e.g. UTF8 and write the accented characters directly. It might cost a bit in setup (LaTeX system and also e.g. keyboard/display), but it is definitely worth it. – vonbrand Oct 30 '15 at 12:08
  • @kornaros -- it is not possible to treat a string of letters as a single character. a control sequence is defined by tex as (1) a backslash followed by one or more letters up to the next non-letter, or (2) a backslash followed by a single non-letter. to change this, one would have to redesign and re-implement tex itself. – barbara beeton Oct 30 '15 at 13:54
  • @barbara Thank you for the explanation! You gave me an idea! Is it possible to make a non letter character as a control character inside a special enviroment without the use of additional \ ? Like using @ etc. instead the command \7 above? In other words Is it possible something like gr@a@eal to work?? – kornaros Oct 31 '15 at 4:07

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.