font switches: bold, slanted, etc.
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)? Alan
On 02/13/2016 12:23 AM, Alan BRASLAU wrote:
[...] 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)?
Sorry, Alan, but I don’t see the point you’re trying to make. I guess \em is your friend here: \starttext \startTEXpage[offset=1em] {\bf Heading {\em One}} {\bf Heading {\em One {\em Extended}}} {\bf Heading {\sl Two}} {\bf Heading {\sl One {\sl Extended}}} \stopTEXpage \stoptext It has two main advantages over \sl: it accepts bold and double emphasis means no emphasis. Or what I am missing? Just in case it helps, Pablo -- http://www.ousia.tk
On 02/13/2016 11:02 AM, Alan BRASLAU wrote:
On Sat, 13 Feb 2016 02:14:10 +0100 Pablo Rodriguez wrote:
I guess \em is your friend here:
Yes, silly me, of course \em nests well with bold as does mathematics: [...]
Alan, please, no derogatory remarks about list members :-). There is a Latin quote from Horace («Ars poetica», 359, http://www.perseus.tufts.edu/hopper/text?doc=Hor.+Ars+369&fromdoc=Perseus%3Atext%3A1999.02.0064 [of course, Thomas knows way better than myself, since I’m not even an amateur]): quandoque bonus dormitat Homerus which translates (according to Merriam-Webster [http://www.merriam-webster.com/dictionary/aliquando%20bonus%20dormitat%20hom...]): sometimes (even) good Homer nods We are all human beings (although ones more perfect and with more ConTeXt knowledge than others :-)). Cheers, Pablo -- http://www.ousia.tk
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
On Sat, 13 Feb 2016 10:53:22 +0100
Wolfgang Schuster
There are a few font switches which change the style dependant on the current style
Thanks for this table; I wikified it (under Font Switches, of course). It mysteriously introduces \typeface, \swapface and \boldface. I wonder, though, is there anything similar to boldsmallcapitals? Does this even exist in any fonts?
but I guess you’re looking for something like this (similar to the LaTeX font system):
I wouldn't dream of something similar to LaTeX... Alan
Alan BRASLAU mailto:alan.braslau@cea.fr 13. Februar 2016 um 11:30 On Sat, 13 Feb 2016 10:53:22 +0100 Wolfgang Schuster
wrote: There are a few font switches which change the style dependant on the current style
Thanks for this table; I wikified it (under Font Switches, of course). It mysteriously introduces \typeface, \swapface and \boldface.
I wonder, though, is there anything similar to boldsmallcapitals? Does this even exist in any fonts? It depends on the font, with Latin Modern this isn’t possible because it uses a separate font for smallcaps but with TeX Gyre you can do this:
\setupbodyfont[pagella] \starttext Text {\feature[+][smallcaps]Text} {\bf Text \feature[+][smallcaps]Text} Text {\feature[+][smallcaps]Text \bf Text} \stoptext
but I guess you’re looking for something like this (similar to the LaTeX font system):
I wouldn't dream of something similar to LaTeX... The font switches aren't that bad but as I have shown there is no need to have different commands for \XXX{....} and {\XXX ...}.
Wolfgang
On Sat, 13 Feb 2016 11:47:52 +0100
Wolfgang Schuster
Alan BRASLAU mailto:alan.braslau@cea.fr 13. Februar 2016 um 11:30
I wonder, though, is there anything similar to boldsmallcapitals? Does this even exist in any fonts? It depends on the font, with Latin Modern this isn’t possible because it uses a separate font for smallcaps but with TeX Gyre you can do this:
\setupbodyfont[pagella]
\starttext
Text {\feature[+][smallcaps]Text} {\bf Text \feature[+][smallcaps]Text}
Text {\feature[+][smallcaps]Text \bf Text}
\stoptext
Thank you. This is nice, as TeX Gyre is a very good base for most use (unless one specifically needs/wants a different font). So I wonder if \smallcaps could be easily made to use this \feature automagically if it exists in the font? Maybe it does this already: \setupbodyfont[pagella] \starttext Text {\bf Text \feature[+][smallcaps]Text} Text {\bf Text \smallcaps Text} \stoptext Alan
Alan BRASLAU mailto:alan.braslau@cea.fr 13. Februar 2016 um 16:55 On Sat, 13 Feb 2016 11:47:52 +0100
Thank you.
This is nice, as TeX Gyre is a very good base for most use (unless one specifically needs/wants a different font). So I wonder if \smallcaps could be easily made to use this \feature automagically if it exists in the font? Maybe it does this already:
\setupbodyfont[pagella]
\starttext
Text {\bf Text \feature[+][smallcaps]Text}
Text {\bf Text \smallcaps Text}
\stoptext The \smallcaps command only enables the feature in the font but it performs no check.
You can use the \doifelsecurrentfonthasfeatur command to check if a feature is present in the currently used font. \def\autosmallcaps {\doifelsecurrentfonthasfeature{smcp}\setsmallcaps\sc} \starttext {Text \autosmallcaps Text} {\it Text \autosmallcaps Text} {\bf Text \autosmallcaps Text} \blank \setupbodyfont[pagella] {Text \autosmallcaps Text} {\it Text \autosmallcaps Text} {\bf Text \autosmallcaps Text} \stoptext Wolfgang
On 2/13/2016 12:23 AM, Alan BRASLAU wrote:
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?
normally \em will adapt itself
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)?
guess why we need real 'bold math fonts' (a project related to the gyre fonts but not yet started) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (4)
-
Alan BRASLAU
-
Hans Hagen
-
Pablo Rodriguez
-
Wolfgang Schuster