Difference between revisions of "Bold typewriter"

From Wiki
Jump to navigation Jump to search
m (Added note about the change of fonts from cmttb to cmbtt, changed wording around it slightly.)
m (Removed a spam ad at the top of this page!)
 
(13 intermediate revisions by 8 users not shown)
Line 1: Line 1:
< [[From LaTeX to ConTeXt]]
+
< [[From LaTeX to ConTeXt]] >
  
LaTeX:
+
== ConTeXt ==
<pre>
 
\documentclass{article}
 
\DeclareFontShape{OT1}{cmtt}{bx}{n}{
 
  <5><6><7><8><9><10><10.95><12><14.4><17.28><20.74><24.88>cmttb10}{}
 
\begin{document}
 
\texttt{Normal and \textbf{bold Typewriter.}}
 
\end{document}
 
</pre>
 
  
ConTeXt:
+
The exact same thing can be done in ConTeXt, although the syntax is slightly more verbose.
Put this in /usr/share/texmf/tex/context/third/type-loc.tex to define the bold typewriter fonts:
+
 
<pre>
+
<texcode>
 +
\definebodyfont [12pt] [tt] [bf=cmttb10 at 12pt]
 +
\definebodyfont [11pt] [tt] [bf=cmttb10 at 11pt]
 +
\definebodyfont [10pt] [tt] [bf=cmttb10]
 +
\definebodyfont [9pt] [tt] [bf=cmttb10 at 9pt]
 +
\definebodyfont [8pt] [tt] [bf=cmttb10 at 8pt]
 +
 
 +
\starttext
 +
{\tt Normal and \bf bold Typewriter.}
 +
\stoptext
 +
</texcode>
 +
 
 +
However, instead of requiring that this be defined in each document, ConTeXt also provides the possibility of including it automatically as part of the default font setups.  This can be done by putting the following typescript definitions in <code>/usr/share/texmf/tex/context/third/type-loc.tex</code>.  The version shown here also uses the newer (and bolder) <code>cmbtt</code> family; to use the older <code>cmttb10</code> fonts, uncomment them and comment out the other set.
 +
 
 +
<texcode>
 
\starttypescript [mono] [computer-modern] [size]
 
\starttypescript [mono] [computer-modern] [size]
\definebodyfont [12pt] [tt] [bf=cmbtt10 at 12pt]
+
% Newer, more-bold version of the bold typewriter fonts.
\definebodyfont [11pt] [tt] [bf=cmbtt10 at 11pt]
+
  \definebodyfont [12pt] [tt] [bf=cmbtt10 at 12pt]
\definebodyfont [10pt] [tt] [bf=cmbtt10]
+
  \definebodyfont [11pt] [tt] [bf=cmbtt10 at 11pt]
\definebodyfont [9pt] [tt] [bf=cmbtt9]
+
  \definebodyfont [10pt] [tt] [bf=cmbtt10]
\definebodyfont [8pt] [tt] [bf=cmbtt8]
+
  \definebodyfont [9pt] [tt] [bf=cmbtt9]
 +
  \definebodyfont [8pt] [tt] [bf=cmbtt8]
 +
%% Older, less-bold version of the bold typewriter fonts.
 +
%  \definebodyfont [12pt] [tt] [bf=cmttb10 at 12pt]
 +
%  \definebodyfont [11pt] [tt] [bf=cmttb10 at 11pt]
 +
%  \definebodyfont [10pt] [tt] [bf=cmttb10]
 +
%  \definebodyfont [9pt] [tt] [bf=cmttb10 at 9pt]
 +
%  \definebodyfont [8pt] [tt] [bf=cmttb10 at 8pt]
 
\stoptypescript
 
\stoptypescript
</pre>
+
</texcode>
  
(Note that this is using the more recent <tt>cmbtt[8,9,10]</tt> family of fonts, rather than the older <tt>cmttb10</tt> font used in the LaTeX example.)
+
Then, the fonts can be accessed without any additional setup in the documents, as in this example:
 
+
<texcode>
Then, the fonts can be accessed as in this example:
 
<pre>
 
 
\starttext
 
\starttext
 
{\tt Normal and \bf bold Typewriter.}
 
{\tt Normal and \bf bold Typewriter.}
 
\stoptext
 
\stoptext
</pre>
+
</texcode>
 +
 
 +
The support for bold typewriter exists also as a module: http://pmrb.free.fr/work/OS/ConTeXt/
 +
 
 +
(''But it would be great if those definitions were a part of [[source:type-siz.tex|type-siz.tex]]; --[[User:Mojca Miklavec|Mojca]]'')
 +
 
 +
[[Category:Fonts]]
 +
[[Category:From LaTeX]]

Latest revision as of 19:13, 13 November 2013

< From LaTeX to ConTeXt >

ConTeXt

The exact same thing can be done in ConTeXt, although the syntax is slightly more verbose.

\definebodyfont [12pt] [tt] [bf=cmttb10 at 12pt]
\definebodyfont [11pt] [tt] [bf=cmttb10 at 11pt]
\definebodyfont [10pt] [tt] [bf=cmttb10]
\definebodyfont [9pt] [tt] [bf=cmttb10 at 9pt]
\definebodyfont [8pt] [tt] [bf=cmttb10 at 8pt]

\starttext
{\tt Normal and \bf bold Typewriter.}
\stoptext

However, instead of requiring that this be defined in each document, ConTeXt also provides the possibility of including it automatically as part of the default font setups. This can be done by putting the following typescript definitions in /usr/share/texmf/tex/context/third/type-loc.tex. The version shown here also uses the newer (and bolder) cmbtt family; to use the older cmttb10 fonts, uncomment them and comment out the other set.

\starttypescript [mono] [computer-modern] [size]
% Newer, more-bold version of the bold typewriter fonts.
  \definebodyfont [12pt] [tt] [bf=cmbtt10 at 12pt]
  \definebodyfont [11pt] [tt] [bf=cmbtt10 at 11pt]
  \definebodyfont [10pt] [tt] [bf=cmbtt10]
  \definebodyfont [9pt] [tt] [bf=cmbtt9]
  \definebodyfont [8pt] [tt] [bf=cmbtt8]
%% Older, less-bold version of the bold typewriter fonts.
%  \definebodyfont [12pt] [tt] [bf=cmttb10 at 12pt]
%  \definebodyfont [11pt] [tt] [bf=cmttb10 at 11pt]
%  \definebodyfont [10pt] [tt] [bf=cmttb10]
%  \definebodyfont [9pt] [tt] [bf=cmttb10 at 9pt]
%  \definebodyfont [8pt] [tt] [bf=cmttb10 at 8pt]
\stoptypescript

Then, the fonts can be accessed without any additional setup in the documents, as in this example:

\starttext
{\tt Normal and \bf bold Typewriter.}
\stoptext

The support for bold typewriter exists also as a module: http://pmrb.free.fr/work/OS/ConTeXt/

(But it would be great if those definitions were a part of type-siz.tex; --Mojca)