Created
October 17, 2012 14:26
-
-
Save phi-gamma/3905799 to your computer and use it in GitHub Desktop.
[example] basic style handler usage (for ConTeXt wiki)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% macros=mkvi | |
\unprotect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
\installnamespace {look} | |
\installcommandhandler \????look {look} \????look | |
\appendtoks | |
\setuevalue{\currentlook}{\do_look{\currentlook}} | |
\to \everydefinelook | |
\unexpanded\def\do_look#id{% | |
\edef\currentlook{#id}% | |
\dosingleempty\do_do_look% | |
} | |
\def\do_do_look[#parms]#content{% | |
\begingroup | |
\iffirstargument\setupcurrentlook[#parms]\fi | |
\uselookstyleandcolor\c!style\c!color% | |
#content% | |
\endgroup% | |
} | |
\protect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
\definelook [mybold] [style=bold] | |
\definelook [myslant] [style=slanted] | |
\definelook [myitalics] [style=italic] | |
\definelook [mybig] [style=bigger] | |
\definelook [mycaps] [style=smallcaps] | |
\definelook [complicated] [style={\ssxx\bold\addff{oldstyle}}] | |
\starttext %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
Ordinary Text Before | |
\mybold {bold text} | |
\myslant {slanted text} | |
\myitalics {italic text} | |
\mybig {oversize text} | |
\mycaps {small capitals} | |
\complicated {0.5 + 14.134725i} | |
Ordinary Text After | |
\stoptext %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment