Tag Info

Hot answers tagged

14

You can access the glyphs contained in a font with the fnt-10 module: \usemodule [fnt-10] \starttext \ShowCompleteFont{name:minionproregular}{10pt}{1} \stoptext This outputs a list of the glyphs, the Unicode values and the glyph names. You get the font name on the console with mtxrun -script fonts -list -all When you have the font and the glyph name ...


13

What you're after is the build_parshape macro and the shapetext environment. build_parshape takes a MetaPost path as an argument and aligns the text to the path. shapetext, well… the name already reveals what it's doing. This is detailed in the MetaPost manual chapter 10 Typesetting in MetaPost. I don't know of a simple way to extract the shape of an ...


12

Plain tex version (using e-tex arithmetic could be written in classic tex if needed) \vsize 4\baselineskip \hsize 5cm \pdfpageheight\dimexpr6\baselineskip+2in\relax \pdfpagewidth\dimexpr\hsize+2in\relax \footline={ \hss\tenrm [original plain footer: \folio] \ifnum\numexpr ((\pageno-1)/16)*16\relax=\numexpr\pageno-1\relax {\fiverm [The title (page ...


12

Below is my approach to this but it modifies the user interface a bit so that it looks more Context-ish. (You can skip the implementation and start reading the code with the section “user interface”.) EDIT: The code has been updated to reflect new functionality added with version 2012-09-21 of ConTeXt. No hacks necessary anymore ;-) Also, the rule final is ...


11

You can define a command that expands to "apple", another that expands to whatever you want to test, and then use \ifx. Here's a latex file that demonstrates this: \documentclass{article} \begin{document} \def\appleref{apple} \def\testit#1{% \def\temp{#1}% \ifx\temp\appleref Yes, it's apple. \else No, it's #1. \fi } apple: ...


11

How can I set ConTeXt to automatically switch fonts when I switch to a different language? There might be a misconception involved here as to what \language[foo] actually does. It changes the current hyphenation rules, but is by no means a switch to another script and/or type face. For this reason your question can be interpreted in (at least) two ways: ...


11

The syntax for ConTeXt tables is: \starttable[...] \NC ... \NC ... \NC \NR \NC ... \NC ... \NC \NR \stoptable You are missing the last \NC. If you add that, then the document compiles correctly. However, I would use a different approach to markup the document. Instead of \define[3]\Recipe{% \section[#1]{#2}% \startcolumns[n=2,rule=on] ...


11

I fail to find the quote you mention in the manual. (see edit) TikZ is supported in the current ConTeXt. However, there are not many people using TikZ in ConTeXt. That, in turn, means that bugs are not detected that easily. When you translate the LaTeX specific commands that are used in the manual (e.g. font switching commands) to ConTeXt-flavoured ones, ...


11

The difference are the catcodes. \startlua uses TeX catcodes, startluacode uses Lua catcodes. Two examples: \starttext \startlua -- fails both -- context("Foo %Bar") -- %context("Foo \n Bar") \stoplua \startluacode -- prints Foo -- context("Foo %Bar") -- prints Foo Bar context("Foo \n Bar") \stopluacode \stoptext For more information you can have a ...


10

This is not a perfect solution, but it is close, and you can get there with very little effort. Basically use textbackground and change the radius using the radius key. For example: \definecolor [lightblue] [r=0.5, g=0.5, b=1] \definetextbackground [placeholder] [ location=text, background=color, backgroundcolor=lightblue, ...


10

For reference: There are two definitions of \define: The first one in syst-aux.mkiv shows the behavior Egreg mentioned in his comment: if the macro is already defined, it leaves it as it is. (A companion, \redefine allows you to overwrite the current definition of macro regardless of its being in use.) Ironically, this preliminary definition is overwritten ...


10

Typescript-based version : \usetypescriptfile[asana] \definefontfeature[default][default][onum=yes] \starttypescript[me] \definetypeface [me] [rm] [serif] [pagella] [default] \definetypeface [me] [ss] [sans] [heros] [default] \definetypeface [me] [tt] [mono] [cursor] [default] \definetypeface [me] [mm] [math] [asana] [default] ...


10

Here is one way to do this in ConTeXt: % Set footnotes in small size \setupfooter[style=small] % Determine footnote content based on lua code \setupfootertexts[\luasetup{footer}] % Get the page number. If page % 16 == 1, typeset content \startluasetups footer local counters = structures.counters local page = counters.value("userpage") local ...


10

The fix (short version) You are missing the plain compatibility mode: \starttext \startMPcode useplainlabels ; input piechartmp; Segment(30, "first"); Segment(70, "second"); PieChart(1cm, 0, 0, 0, 0); Label.auto(0)(name)(outwards,0); ResetSegments; \stopMPcode \stoptext Reason for the failure In contrast to traditional ...


10

ConTeXt moves several primitives, renaming them systematically using the prefix \normal.... For ConTeXt MkII, all but one of the primitives moved are from TeX90: there is also one from e-TeX: \end \everyjob \input \language \mathop \month \outer \over \unexpanded \vcenter All of these are saved as \normal..., e.g. \normalend is the \end primitive. ...


9

You can set a prefix for each float type with the referenceprefix key for the \setupcation command. \setupexternalfigures[location=default] \setupcaption[figure][referenceprefix=figure] \setupcaption[table] [referenceprefix=table] \starttext \dorecurse{3}{\input knuth\par} \startplacefigure[title=Test figure,reference=test] ...


9

Use: \setuphead [part][placehead=yes] The placement can be tuned using the standard \setuphead keys.


9

First define a page break: \definepagebreak [chapterpagebreak] [yes, left] Then set up the chapters to use this new defined page break: \setuphead [chapter] [page=chapterpagebreak] More information on the ConTeXt wiki - definepagebreak and Truly empty pagebreak before chapters.


9

There are at least two approaches here, but both relate to the way that TeX and Lua interact with respect to category code (see Can the Lua part of LuaTeX know about tokens? for more on this). What is happening is that \# escapes the # when TeX transfers the input to Lua, but when Lua transfers the result back to TeX you just have # with category code 6. ...


9

ConTeXt provides a macro \handletokens which passes each token to a command. You can use \handletokens to print text vertically (or along a path, as shown in the MetaFun manual). In the example below, I also horizontally align the letters, which gives a nicer output than the default left aligned letters. \define[1]\AddLine{#1\crlf} \define[1]\printascolumn ...


9

You can use \hyphenpenalty1000 in ConTeXt as well. However, the native ConTeXt way to suppress hyphenation is to use \setupalign [nothyphenated] To suppress hyphenation only for \margintext you use the command \setupmargindata \setupmargindata [margintext] [align=nothyphenated] To apply several keys to align separate them with a comma and surround ...


9

There are two ways to use system fonts. Write your own typescript. ConTeXt comes with the typescripts for most system fonts. See type-imp-*.mkiv for details. For example, the typescript for calibra is defined in type-imp-calibra.mkiv and the typescript for calibiri is defined in type-imp-cleartype.mkiv. To use them, you need to define your own typescript ...


9

As Aditya already answered, the most common way is to use \startstandardmakeup, as in: \starttext \startstandardmakeup \startalignment[center] % or \centerline{...} {\definedfont[Bold at 40pt] Title} \stopalignment \stopstandardmakeup document text \stoptext


8

Marking are usually shown in a way so that they do no show when the page is cut. One way to see what is happening is to set the print paer size to A3. For example, \setuppapersize[A5,landscape][A3] \setuparranging[2TOP] \setuplayout [ topspace=1cm, backspace=1cm, header=0mm, footer=0mm, width=middle, height=middle, marking=on, ...


8

This answer uses a different mechanism, so I am posting it as a separate answer rather than editing the previous one. This is not a complete answer, but a proof of concept that works if the phrase is split across lines only once. It is possible to extend it so that it works if the phrase is split across multiple lines and/or multiple pages, but that requires ...


8

What Marco said: use ConTeXt's multi-pass data mechanism. Here's how. % Define a dataset that will store our key-value tables \definedataset[mydataset] \starttext \framed[ % Here we use \datasetvariable to retrieve the values of myheight and mywidth. % Notice that we only define those values further on in the document. % Notice also that we ...


8

Here is an example to get you started: \def\buildtextgrave{\topaccent{3pt}{0}{15}{\textgrave}} \def\buildtextacute{\topaccent{3pt}{0}{15}{\textacute}} \def\buildtextcaron{\topaccent{3pt}{0}{15}{\textcaron}} \starttext \buildtextcedilla ü \buildtextmacron ü \buildtextgrave ü \buildtextacute ü \buildtextcaron ü \stoptext The arguments ...


8

The support for an "e" size has been discontinued in the core. But if you want it, it is easy to add, like so (somewhere before your \setupbodyfont): \definefontsize[e] \setupbodyfontenvironment[default][e=2.5]


8

The Charis SIL enables the ffi ligature for latin scripts. Either activate this feature locally \setupbodyfont[charissil] {\feature[+][latn]Charis SIL: Difficult} or globally \definefontfeature [default] [default] [script=latn]


8

Use the text key: \setupitemize [stopper=] \starttext Five animals lived in the forest: \startitemize [n,text] \startitem bears, \stopitem \startitem snakes, \stopitem \startitem fish, \stopitem \startitem birds, and \stopitem \startitem wolves. \stopitem \stopitemize \stoptext Result: The stopper key is ...



Only top voted, non community-wiki answers of a minimum length are eligible