⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 335-338.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<HTML>

<HEAD>

<TITLE>Linux Unleashed, Third Edition:geqn and gtbl</TITLE>

<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!--ISBN=0672313723//-->

<!--TITLE=Linux Unleashed, Third Edition//-->

<!--AUTHOR=Tim Parker//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Sams//-->

<!--CHAPTER=18//-->

<!--PAGES=335-338//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="331-335.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="338-340.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H4 ALIGN="LEFT"><A NAME="Heading7"></A><FONT COLOR="#000077">Square Roots</FONT></H4>

<P>To draw a square root symbol, use the keyword <TT>sqrt</TT>, and <TT>geqn</TT> ensures that the square root symbol is properly drawn to enclose all parts of the equation that are indicated as belonging to the square root. Very large square root signs that cover a lot of material on many lines, for example, do not look particularly good when printed. You may want to consider using the superscript 0.5 instead.</P>

<P>You can use <TT>sqrt</TT> quite easily. For example, the command</P>

<!-- CODE SNIP //-->

<PRE>

sqrt a&#43;c - 1 over sqrt &#123;alpha &#43; beta&#125;

</PRE>

<!-- END CODE SNIP //-->

<P>shows the first square root sign over <TT>a&#43;c</TT> and the second one over the part in braces.</P>

<H4 ALIGN="LEFT"><A NAME="Heading8"></A><FONT COLOR="#000077">Summations, Set Theory, and Integrals</FONT></H4>

<P>To produce a summation, use the keyword <TT>sum</TT> and the keywords <TT>from</TT> and <TT>to</TT> to show the upper and lower parts of the command. For example, use the command</P>

<!-- CODE SNIP //-->

<PRE>

sum from x=1 to x=100 x sup 2

</PRE>

<!-- END CODE SNIP //-->

<P>to create the formula for summing <TT>x</TT> squared over the range 1 to 100. If you want to use a special word, use braces:</P>

<!-- CODE SNIP //-->

<PRE>

sum from x=1 to &#123;x= inf&#125; x sup 2

</PRE>

<!-- END CODE SNIP //-->

<P>This is the same command, except summing from 1 to infinity. The braces ensure that the <TT>to</TT> component is properly interpreted. If no <TT>from</TT> or <TT>to</TT> component is specified, they are not printed.</P>

<P>To use integrals, the keyword <TT>int</TT> is used and can again take a <TT>from</TT> argument:</P>

<!-- CODE SNIP //-->

<PRE>

lim from n=1 xy sup 3 = 9

</PRE>

<!-- END CODE SNIP //-->

<P>Other reserved words for <TT>geqn</TT> are used with set theory. You can use the keywords <TT>union</TT> and <TT>inter</TT> for the union and intersection of sets.</P>

<H4 ALIGN="LEFT"><A NAME="Heading9"></A><FONT COLOR="#000077">Brackets, Bars, and Piles</FONT></H4>

<P>As equations get more complicated, you will need to use more brackets and braces. You can generate brackets (<TT>[]</TT>), braces (<TT>&#123;&#125;</TT>), and parentheses (<TT>()</TT>) as needed using the <TT>left</TT> and <TT>right</TT> commands:</P>

<!-- CODE SNIP //-->

<PRE>

left &#123; b over d&#43;1&#125; = left ( alpha over &#123;beta &#43; gamma&#125; )

</PRE>

<!-- END CODE SNIP //-->

<P>This produces large braces, and parentheses are required to surround the terms. You can nest these, of course, with <TT>geqn</TT> adjusting the sizes properly. Braces are usually bigger than brackets and parentheses.</P>

<P>For floor and ceiling characters, use the <TT>left floor</TT>, <TT>right floor</TT>, <TT>left ceiling</TT>, and <TT>right ceiling</TT> commands. For example:</P>

<!-- CODE SNIP //-->

<PRE>

left ceiling x over alpha right ceiling &gt; left floor beta over 2 right

floor

</PRE>

<!-- END CODE SNIP //-->

<P>draws the equation with the proper vertical bars and ceiling and floor markers.

</P>

<P>To create a pile of elements, use the reserved word <TT>pile</TT>. The following example shows the usage best:</P>

<!-- CODE SNIP //-->

<PRE>

X = left [ pile &#123; a above b above c &#125; right ]

</PRE>

<!-- END CODE SNIP //-->

<P>This produces output with the three elements <TT>a</TT>, <TT>b</TT>, and <TT>c</TT> stacked vertically within big braces.</P>

<H4 ALIGN="LEFT"><A NAME="Heading10"></A><FONT COLOR="#000077">Matrices</FONT></H4>

<P>To make a matrix requires a little more work. You could probably make a matrix using the <TT>pile</TT> command, but if the elements are not of equal height, they will not line up. For that reason, use the keyword <TT>matrix</TT>. The general format is</P>

<!-- CODE SNIP //-->

<PRE>

matrix &#123;

 ccol &#123; elements &#125;

 ccol &#123; elements &#125;

</PRE>

<!-- END CODE SNIP //-->

<P>in which <TT>ccol</TT> produces centered columns. For left-adjusted columns, use <TT>lcol</TT>; <TT>rcol</TT> produces right-adjusted columns. The elements are specified individually. For example, the command</P>

<!-- CODE SNIP //-->

<PRE>

matrix &#123;

 ccol &#123; x sub 1 above y sub 1 &#125;

 ccol &#123; x sub 2 above y sub 2 &#125;

</PRE>

<!-- END CODE SNIP //-->

<P>produces the matrix

</P>

<!-- CODE SNIP //-->

<PRE>

x<SUP>1</SUP> x<SUP>2</SUP>

y<SUP>1</SUP> y<SUP>2</SUP>

</PRE>

<!-- END CODE SNIP //-->

<P>All matrices must have the same number of elements in each column or <TT>geqn</TT> can&#146;t process the matrix properly.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>Note:&nbsp;&nbsp;</B><BR>Some mathematical packages allow you to have varying numbers of elements in matrix columns. This is a bad practice because such a table is no longer a real matrix. Each column should have exactly the same number of elements, as should each row.<HR></FONT>

</BLOCKQUOTE>

<H4 ALIGN="LEFT"><A NAME="Heading11"></A><FONT COLOR="#000077">Quoted Text</FONT></H4>

<P>Any characters placed within quotation marks are not interpreted by <TT>geqn</TT>. This is useful for text strings that may contain reserved words, such as the following:</P>

<!-- CODE SNIP //-->

<PRE>

italics &#147;beta&#148; = beta &#43; gamma

</PRE>

<!-- END CODE SNIP //-->

<P>Here, the word <TT>beta</TT> will appear in italics without being converted to the beta character.</P>

<H4 ALIGN="LEFT"><A NAME="Heading12"></A><FONT COLOR="#000077">Character Changes</FONT></H4>

<P>You can change font and point size with <TT>geqn</TT> in much the same way as with <TT>groff</TT>. The default setting is usually Roman 10 point. If you want to set bold characters, use the keyword <TT>bold</TT>; <TT>italic</TT> sets italic font.</P>

<!-- CODE SNIP //-->

<PRE>

x=y bold alpha

</PRE>

<!-- END CODE SNIP //-->

<P>You can also use the keyword <TT>fat</TT>, which widens the character (useful for things such as grad characters). These reserved words affect only what immediately follows, so you must use braces if the area to be changed is more than a single block of characters.</P>

<!-- CODE SNIP //-->

<PRE>

x=y*2 bold &#123;alpha &#43; gamma&#125;

</PRE>

<!-- END CODE SNIP //-->

<P>To change the size of characters, use the <TT>size</TT> keyword:</P>

<!-- CODE SNIP //-->

<PRE>

size 16 &#123;alpha &#43; beta&#125;

</PRE>

<!-- END CODE SNIP //-->

<P>This sets the enclosed text in 16 point size. Incremental changes are acceptable.

</P>

<P>To affect the entire equation, you can use the <TT>gsize</TT> (global size) and <TT>gfont</TT> (global font) commands at the start of the <TT>geqn</TT> block:</P>

<!-- CODE SNIP //-->

<PRE>

.EQ

gsize 14

gfont H

&#133;.

</PRE>

<!-- END CODE SNIP //-->

<P>This makes it easy to format the equations however you wish.

</P>

<H4 ALIGN="LEFT"><A NAME="Heading13"></A><FONT COLOR="#000077">Using geqn</FONT></H4>

<P>As you have seen, <TT>geqn</TT> is quite friendly and easy to use, especially if you are used to writing out equations longhand. You should play around with the system and learn the different features. There are more commands available within <TT>geqn</TT>, but the main ones have been shown to you. For more information, check the man pages or a good <TT>groff</TT> book that includes <TT>eqn</TT>.</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="331-335.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="338-340.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>





</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -