From: Wolfgang Schuster <schuster.wolfgang@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: font switches: bold, slanted, etc.
Date: Sat, 13 Feb 2016 10:53:22 +0100 [thread overview]
Message-ID: <56BEFD12.5040700@gmail.com> (raw)
In-Reply-To: <20160212162306.42e612a9@cea.fr>
[-- Attachment #1.1: Type: text/plain, Size: 3742 bytes --]
> Alan BRASLAU <mailto:alan.braslau@cea.fr>
> 13. Februar 2016 um 00:23
> Hi,
>
> Basic font switches are bold (\bf), italic (\it), slanted (\sl), ...
> and one can have bolditalic (\bi), boldslated (\bs), etc.
> We also have style=bold, style=slanted, etc.
>
> Is there some way to manipulate font switches so that
> \bold{This text is \slated{bold}}
> for example, would put the word "bold" into boldslanted?
>
> A natural use of this is, e.g. headers that get typeset in bold. What
> if the title contains a word, say, in slanted (or, worse, some
> mathematics)?
There are a few font switches which change the style dependant on the
current style
\starttext
\starttabulate[|l|f{\tf}l|f{\it}l|f{\sl}l|f{\bf}l|f{\bi}l|f{\bs}l|]
\NC \NC \tttf \tex{tf} \NC \tttf \tex{it} \NC \tttf
\tex{sl} \NC \tttf \tex{bf} \NC \tttf \tex{bi} \NC \tttf \tex{bs} \NC\NR
\NC \NC Text \NC Text \NC
Text \NC Text \NC Text \NC Text \NC\NR
\NC \tex{em} \NC \em Text \NC \em Text \NC \em
Text \NC \em Text \NC \em Text \NC \em Text \NC\NR
\NC \tex{boldface} \NC \boldface Text \NC \boldface Text \NC \boldface
Text \NC \boldface Text \NC \boldface Text \NC \boldface Text \NC\NR
\NC \tex{typeface} \NC \typeface Text \NC \typeface Text \NC \typeface
Text \NC \typeface Text \NC \typeface Text \NC \typeface Text \NC\NR
\NC \tex{swapface} \NC \swapface Text \NC \swapface Text \NC \swapface
Text \NC \swapface Text \NC \swapface Text \NC \swapface Text \NC\NR
\stoptabulate
\stoptext
but I guess you’re looking for something like this (similar to the LaTeX
font system):
\unprotect
\def\texttf_direct
{\ifx\fontalternative\s!it \tf \else
\ifx\fontalternative\s!sl \tf \else
\ifx\fontalternative\s!bi \bf \else
\ifx\fontalternative\s!bs \bf \fi\fi\fi\fi}
\def\textbf_direct
{\ifx\fontalternative\s!tf \bf \else
\ifx\fontalternative\s!it \bi \else
\ifx\fontalternative\s!sl \bs \fi\fi\fi}
\def\textit_direct
{\ifx\fontalternative\s!tf \it \else
\ifx\fontalternative\s!sl \it \else
\ifx\fontalternative\s!bf \bi \else
\ifx\fontalternative\s!bs \bi \fi\fi\fi\fi}
\def\textsl_direct
{\ifx\fontalternative\s!tf \sl \else
\ifx\fontalternative\s!it \it \else
\ifx\fontalternative\s!bf \bs \else
\ifx\fontalternative\s!bi \bs \fi\fi\fi\fi}
\def\textem_direct
{\ifx\fontalternative\s!tf \it \else
\ifx\fontalternative\s!it \tf \else
\ifx\fontalternative\s!sl \tf \else
\ifx\fontalternative\s!bf \bi \else
\ifx\fontalternative\s!bi \bf \else
\ifx\fontalternative\s!bs \bf \fi\fi\fi\fi\fi\fi}
\def\texttf_indeed{\bgroup\texttf_direct\let\nexttoken}
\def\textbf_indeed{\bgroup\textbf_direct\let\nexttoken}
\def\textit_indeed{\bgroup\textit_direct\let\nexttoken}
\def\textsl_indeed{\bgroup\textsl_direct\let\nexttoken}
\def\textem_indeed{\bgroup\textem_direct\let\nexttoken}
\unexpanded\def\texttf{\doifelsenextbgroup\texttf_indeed\texttf_direct}
\unexpanded\def\textbf{\doifelsenextbgroup\textbf_indeed\textbf_direct}
\unexpanded\def\textit{\doifelsenextbgroup\textit_indeed\textit_direct}
\unexpanded\def\textsl{\doifelsenextbgroup\textsl_indeed\textsl_direct}
\unexpanded\def\textem{\doifelsenextbgroup\textem_indeed\textem_direct}
\protect
\starttext
text {\textbf text \textit text \texttf text \textsl text}
text {\textit text \textbf text \textsl text \texttf text}
text \textbf{text \textit{text} \textsl{text \texttf{text} text}}
text {\textem text \textem text} {\bf text \textem text \textem text}
\stoptext
Wolfgang
[-- Attachment #1.2: Type: text/html, Size: 5201 bytes --]
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2016-02-13 9:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-12 23:23 Alan BRASLAU
2016-02-13 1:14 ` Pablo Rodriguez
2016-02-13 10:02 ` Alan BRASLAU
2016-02-13 10:20 ` Pablo Rodriguez
2016-02-13 9:53 ` Wolfgang Schuster [this message]
2016-02-13 10:30 ` Alan BRASLAU
2016-02-13 10:47 ` Wolfgang Schuster
2016-02-13 15:55 ` Alan BRASLAU
2016-02-13 17:11 ` Wolfgang Schuster
2016-02-13 11:42 ` Hans Hagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56BEFD12.5040700@gmail.com \
--to=schuster.wolfgang@gmail.com \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).