9

1st example:

\starttypescript [\s!serif] [paratype]
  \definefontsynonym [ParatypeSerif-Regular] [\s!name:PTSerif-Regular] [\s!features=\s!default]
  \definefontsynonym [ParatypeSerif-Italic] [\s!name:PTSerif-Italic] [\s!features=\s!default]
  \definefontsynonym [ParatypeSerif-Bold] [\s!name:PTSerif-Bold] [\s!features=\s!default]
  \definefontsynonym [ParatypeSerif-BoldItalic] [\s!name:PTSerif-BoldItalic] [\s!features=\s!default]
\stoptypescript

2nd example:

\definefont[SerifS][\s!file:GenBkBasR at \smallfontsize]

Is \s! only related to fonts? Should I use it in my typescript files?

8
  • Welcome to TeX.sx! Apr 21, 2013 at 11:37
  • 5
    ConTeXt uses ! and :, amongst other characters, for internal material. Hence the commands here are for example \s!file:GenBkBasR, not \s!. Unless you know what you are doing I'd say you should stick to the documented interfaces.
    – Joseph Wright
    Apr 21, 2013 at 11:49
  • @Aditya: you should take your answer to my "ConTeXt (core) command definitions" question and post it here. This question has a narrower scope than mine -- it asks only about \x!... macros -- and a clearer title, so maybe we can make this the canonical Q&A for ConTeXt's multilingual interface.
    – Esteis
    Apr 21, 2013 at 18:07
  • The other answer to my question, by Marco, focuses mainly on namespacing; so if you move/copy your answer here, I can prune my question so that it better matches Marco's answer, and then this question would be a better introduction to your answer.
    – Esteis
    Apr 21, 2013 at 18:20

3 Answers 3

8

\s! is an internal ConTeXt prefix for macros and should be used only if you know what you are doing. For a user defined typescript, use something like

\starttypescript[sans][biolinum][name]
    \setups[font:fallback:Serif]
    \definefontsynonym [Sans]           [name:Linux Biolinum O]             [features=default]
    \definefontsynonym [SansBold]       [name:Linux Biolinum O Bold]        [features=default]
    \definefontsynonym [SansItalic]     [name:Linux Biolinum O Italic]      [features=default]
    \definefontsynonym [SansBoldItalic] [name:Linux Biolinum Slanted O Bold][features=default]
    \definefontsynonym [SansSlanted]    [name:Linux Biolinum O Slanted]     [features=default]
    \definefontsynonym [SansSlantedBold][name:Linux Biolinum Slanted O Bold][features=default]
\stoptypescript
1
  • these should be used if you are interested in a multi-lingual interface as well.
    – Aditya
    Apr 21, 2013 at 15:14
13

As requested by Esteis, I am just moving my answer from another question here. Once Esteis modifies the other question, I'll delete the answer from there, and only keep this one.

What are those pesky \c!..., \v!..., \e!... macros and why does ConTeXt use them?

An often ignored feature of ConTeXt is that it has a multilingual interface. Most tutorials and manuals start with:

\starttext
Hello world
\stoptext

and ask you to compile a document using context filename (which in turn loads the default cont-en format). However, you can also use a French interface

\demarretexte
Hello world
\stoppetexte

if you compile the document with context --interface=fr filename (which in turn loads the French cont-fr format) or add

% interface=fr

on the first line of your file and compile the document with context filename. You can look into mult-def.lua for the available languages and the names of macros in that language.

Defining such a multilingual interface for macros is easy: just \def the French \demarretexte to the English \starttext in the cont-fr format; and do so for all the macros. (This is approximately what ConTeXt does, although now it uses Lua to simplify the mappings).

But ConTeXt also uses a key-value driven interface. In the English interface, you write:

\startchapter[title={A long title in which we say hello to the world},
             marking={Hello world}, % short title for headers and footer
             bookmark={World}, %title for bookmarks
            ]
Hello World.
\stopchapter

So, in the French interface, you'd like to write:

\demarrechapitre[titre={Que celui où nous dire bonjour au monde},
               marquage={Bonjour monde},
               marquepage={Monde}]
Bonjour monde
\stoppechapitre 

How should such a multilingual a key-value driven interface be defined? This is where the \c!... and \v!... macros come in. (Remember that in \unprotected mode ! is a letter, so \c!something is a macro with a name 'c!something`). In the core packages, ConteXt defines

 \definehead[\v!chapter][...]

This defines (amongst other things) a macro \e!start\v!chapter: in the English interface, \e!start=start, \v!chapter=chapter; in the French interface \e!start=demarre, \v!chapter=chapitre. Hence we get \startchapter and \demarrechapitre.

When typesetting a chapter head, ConTeXt uses \currentheadparameter\c!title as the title. In the English interface \c!title translates to title and ConTeXt looks for the title key; in the French interface \c!title translates to titre and ConteXt looks for titre key. Voila, we have a multilingual key-value interface.

3

As detailed on the corresponding wiki page (https://www.contextgarden.net/System_Macros/Scratch_Variables):

  • \s!: These are macros holding system constants, i.e. values that never change
  • \c!: These are macros holding constant keys in key-value pairs. The actual definitions depend on the multi-lingual interface that is currently being used
  • \v!: These are macros holding names of variable values in key-value pairs. The actual definitions depend on the multi-lingual interface that is currently being used
  • \??: These are multi-lingual interface constant calls.
  • \@@: These are results of a multi-lingual interface constant expansion.

As the title of this wiki page indicates these are prefixes for scratch variables, so macros that start with one of them contain various kinds of data.

And of course, as you asked for \??dt##1: This simply recalls the internal name of the system variable as you may see in the corresponding definition of \definesystemvariable:

\unexpanded\def\definesystemvariable#1{\expandafter\edef\csname\??prefix#1\endcsname{\@@prefix#1}}

This answer has been posted before here. As Aditya asked me to repost it here, I duplicated the whole content.

You must log in to answer this question.

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