User:Ali Tarek

= Chestnut Inhouse Style Guide =

Units
Units’ standardization is vital for the purpose of communicating the measurement of physical quantities and the results of a certain experiment. Units can be either defined by convention (i.e. Meter and Kilogram) or by law (i.e. Newton and Joule). For the sake of consistency of our final product, we should stick to definite standards in selecting the unit representation and its typesetting. Here is a brief introduction to the two systems of measurements we use:

International System of Units (SI)
The International System of Units (abbreviated SI) is the most widely used system of measurement. It consists of seven base units. It also has a set of 20 prefixes to the unit names and unit symbols that may be used when specifying multiples and fractions of the units.

United States customary units
It is a system of measurements commonly used in the United States (abbreviated USCS or USC). The United States customary system was developed from English units which were in use in the British Empire before the US declared its independence. For measuring length, the U.S. customary system uses the inch, foot, yard, and mile. The most widely used area unit with a name unrelated to any length unit is the acre. The cubic inch, cubic foot and cubic yard are commonly used for measuring volume.

Units Table: Units table is an online table that includes the units we use and the abbreviations used for different countries and different languages. The column “Label” includes the unit name. In order to find the unit representation in use for every country, we should go through “details”.

Note that:
 * 1) The representation may differ from country to another for the same language.
 * 2) We can use the representation for the unit or either the full name  form label column (e.g. we can write “3 cm” or “3 centimeters”)
 * 3) The only valid units on the system are those listed in the units table, so if there is any required unit that is not found in the table, you should request it.

Representation of units “typing method” There are to modes of typing: Very important notes For more detail these examples for different cases of the LATEX representation of units
 * 1) Text mode: In which we write the units as a full name outside the latex tag (eg.  kilometre, square unit, million, etc). We also can write their abbreviations that do not include superscript as a text for example mL, cm, in., m/s, ...
 * 2) Math mode: In which we need to add the units in the latex tag, this is commonly used with abbreviations with a superscript, powers, fractions or a cdot “short for centred dot in between some of their symbols for example cm2, m/s2, in.2, ... In these cases we use the command $\textrm{abbreviation}^{2}$.
 * There are units that use the command “\textrm” and do not include superscript for example degree celsius, degree Fahrenheit.
 * Some units also use ”\” before typing it inside latex tag for example \$, \%, \mu, ...
 * There are some units do not have abbreviations for example years, billion, square units, ...

Dots
Mathematical copy looks much nicer if you are careful about how groups of three dots are typed in formulae and text. Although it looks fine to type ‘...’ on a typewriter that has a fixed spacing, the result looks too crowded when you’re using a printer’s fonts: ‘$x...y$’ results in ‘x...y’, and such close spacing is undesirable except in subscripts or superscripts. Three Dots can be indicated by two different kinds of dots, one higher than the other; the best mathematical traditions distinguish between these two possibilities. The idea is simply to type \ldots when you want three-low dots (...), and \cdots when you want three-vertically-centered dots ($$\cdots$$). For example:

$x_1+\cdots+x_n$ and  $(x_1,\ldots,x_n)$ $x_1+\ldots+x_n$ and  $(x_1,\cdots,x_n)$

$$x_1+\cdots+x_2$$ and $$(x_1,\ldots,x_2)$$&#x0020;&#x2714; $$x_1+\ldots+x_2$$ and $$(x_1,\cdots,x_2)\times$$

\cdots are used between mathematical operators. For example:

$$10+\cdots+3$$

$$\frac{1}{2}\times\frac{1}{3}\times\frac{1}{4}\times\cdots\times\frac{1}{10}$$

$$1000\,g=\cdots \,kg$$

$$\frac{10}{5}=\frac{\cdots}{2}$$

$$(x^2+1)=(x+1)(\cdots-1)$$

$$64b^3=(\cdots)^3$$

$$12+21=\cdots$$

$$x^\cdots=1$$

\ldots are used between commas, and when things are juxtaposed with no signs between them at all. For example:

$$1,\,2,\ldots,\,4$$

$$\frac{1}{2},\,\frac{1}{3},\,\ldots,\,\frac{1}{4}$$

The square has four $$\ldots$$ angles.

If $$-x<5$$, then $$\ldots$$

Brackets
Various typographical forms of brackets are frequently used in mathematical notation such as round brackets, square brackets [ ] , and curly brackets { }. Typically, a mathematical expression is enclosed between an opening bracket and a matching closing bracket. Generally, such bracketing denotes some form of grouping while evaluating an expression containing a bracketed sub-expression, the operators in the sub-expression take precedence over those surrounding it. Additionally, there are several uses and meanings for different types of brackets.

The brackets are very important to differentiate between various operations used and to keep your intention clear, for example $$(1-tan\,x^2)+1$$ is totally different from $$\color{blue}1-tan(x^2+1)$$.

Brackets should suit the mathematical operators size wize. “\left” and “\right” commands are used for delimiters when they have to change the size dynamically depending on their content.

You cannot split \left...\right across alignment tabs.

\left & \right commands are also used to write a negative number inside the bracket or the modulus to eliminate spaces between the negative sign and the number.

Technically, \left and \right insert an inner node, while ( inserts an opening node. This becomes visible in $f(x)=x+1$ vs. $f\left(x\right)=x+1$. Therefore you can never simply replace “(“by “\left (“and vice versa, you always have to check whether the spacing comes out right.

$$||x+1|+1|$$&#x0020;&#x2714;

$$\left|\left|x+1\right|+1\right|\times$$

$$f(x)=x+1$$&#x0020;&#x0020;&#x2714;

$$f\left(x\right)=x+1\,\,\times$$

The preferred order for bracket enclosure is shown in the following figure.

$$\Biggl\{ \Biggl[ \Biggl( \Bigl\{ \Bigl[ \Bigl( \quad \Bigl) \Bigl] \Bigl\} \Biggl) \Biggl] \Biggl\}$$

Round brackets can be used for things like fractions, ordered pairs, and grouping of simple operations.

Also in mathematical expressions in general, parentheses are used to indicate grouping (that is, which parts belong together).

The following figure shows examples of round brackets.

$$\left( \frac{7}{2} \right)$$

$$\left( 1,-2 \right)$$

$$(2+7)\times 5$$

$$2\times (-5)$$

$$2+(-5)$$

$$2^{\left(10^2\right)}$$

$$(2x+5)\,\textrm{cm}^2$$

$$(x+5)^2$$

$$\left( \frac{2}{5} \right)^2$$

$$\left( 3\frac{2}{5} \right)^{-4}$$

$$(40-7x)^\circ$$

$$\left(x^{-4}\right)^{-8} \times \left(x^{-8}\right)^{-4}$$

$$\left(\sqrt{5}\,\right)^{-1}$$

Square brackets are used for matrices representation, intervals, and grouping standard operations.

The following figure shows examples of Square brackets

$$\begin{bmatrix} 1 & 2\\ 3 & 4\\ 5 & 6\\ \end{bmatrix}$$

$$\left[1, -5\right[$$

$$\left[(3+2) \times (6-4) +7\right] \times 5$$

Curly brackets are used in representation of sets, or more complex operations. The following image shows a set represented by listing using curly brackets.

$$\Biggl\{ \frac{3}{\sqrt{5}}, 1\frac{1}{7}, 4 \Biggl\}$$

However, if there are three levels of grouping in a nested expression, generally, parentheses are used for the innermost groupings, square brackets are used in the next higher level grouping, and curly brackets are used for the outermost groupings

$$\Biggl\{ \Biggl[ \biggl( \biggl\{ \Bigl[ \Bigl] \biggl\} \biggl) \Biggl] \Biggl\}$$

Special Cases of Brackets
If f was a function and x was its argument: who in the mathematician's world would write f x instead of f(x)? So the question really is: “What is the reason to omit the argument's brackets in some cases?” (And how to remember these exceptions? It's sort of remembering the list of all irregular verbs.)

The bottom line here that you want to write out your mathematical expression as clearly as possible.

Simple characters like $$x$$, $$2y$$, or $$\theta$$ can be written without brackets, especially in trigonometric functions, unless there was a need to clarify the mathematical meaning as in the case of fractions angles, angles with labels, and grouping of operations.

$\sinx+\cos5y$

$\sin(x)+\cos(5y)$

$$\sin x+\cos 5y$$&#009;&#x2714;

$$\sin(x)+\cos(5y)\;\times$$

$\tan^2\theta$ $\tan^2(\theta)$

$$\tan ^2 \theta$$&#009;&#x2714;

$$\tan ^2 (\theta)\;\times$$

$\sin\left(\frac{\theta}{2}\right)$

$\sin\frac{\theta}{2}$

$$\sin \left(\frac{\theta}{2}\right)$$&#009;&#x2714;

$$\sin \frac{\theta}{2}\;\times$$

$\cos\left(\angleABC\right)$

$\cos\angleABC$

$$\cos\left(\angle ABC\right)$$&#009;&#x2714;

$$\cos\angle ABC\;\times$$

Spacing
TEX does most of its own spacing in math formulae; and it ignores any spaces that you yourself put between $s. For example, if you type ‘$ x$’ and ‘$ 2 $’, they will mean the same thing as ‘$x$’ and ‘$2$’. You can type ‘$(x + y)/(x - y)$’ or ‘$(x+y) / (x-y)$’.

TEX’s automatic spacing of math formulae makes them look right, and this is almost true. But, occasionally, you must give TEX some help. The number of possible math formulae is vast and TEX’s spacing rules are rather simple, so it is natural that exceptions should arise. It is desirable to have fine units of spacing for this purpose instead of the big chunks that arise from.

The fundamental elements of space that TEX puts into formulae are called thin spaces.

You can add your own spacing whenever you want to, by using the control sequences \, thin space, \_ full space or \quad quadratone.

Some cases in which TEX needs help:

 * Thin space \, 


 * 1) Formulae involving calculus look best when an extra thin space appears before dx or dy or d whatever; but TEX doesn’t do this automatically. Therefore, a well-trained typist will remember to insert ‘\,’ in examples like the following: $$\int_{0}^{\infty}{f(x)\,dx}$$ $\int_{0}^{\infty}{f(x)\,dx}$  $$y\,dx-x\,dy$$ $y\,dx-x\,dy$  $$dx\,dy=r\,dr\,d\theta$$ $dx\,dy=r\,dr\,d\theta$  $$x\,\frac{dy}{dx}$$ $x\,\frac{dy}{dx}$  Similarly, there’s no need for ‘\,’ in cases like $$\int_{1}^{x}{\frac{dt}{t}}$$ $\int_{1}^{x}{\frac{dt}{t}}$ Since “dt” appears all by itself in the numerator of a fraction; this detaches it visually from the rest of the formula.
 * 2) When physical units appear in a formula, they should be separated from the preceding material by a thin space for examples: $$5\,\textrm{cm}^{2}$$ $5\,\textrm{cm}^{2}$
 * A full space “control space,” namely \ which is used when units/adjectives are written as full words, e.g. 5 centimetres, 6 years.
 * A text full space is used between inequality operators $$<$$, $$=$$, or $$>$$ $&lt;$, $=$ , or $&gt;$
 * A quadratone \quad, which is used to separate equations from each other as shown in the following example: $$y=2x \quad \forall x \in \mathbb{N}$$ $y=2x \quad \forall x \in \mathbb{N}$  No spaces are used in the case of dealing with percentages or dollar signs, e.g.  $$80\%$$ $80\%$  $$\$50$$ $\$50$

The units always follow a specific quantity, so what about the spacing between the unit and the value? As discussed above a thin space is used between the value and its unit in the abbreviation form, a full space is used between the value and its unit’s full name but there are cases in which we break this rules.

Special cases for units spacing

 * The unit abbreviations with degrees (degrees, minutes, and seconds, [n&#176;n′n″], degree Celsius [&#176;C], etc.), in these cases no space is left between the numerical value and its unit abbreviation. For example, $$\alpha=30^{\circ}20^{\prime}22^{\prime\prime}$$ $\alpha=30^{\circ}20^{\prime}22^{\prime\prime}$ $$t=30^{\circ}\textrm{C}$$ $t=30^{\circ}\textrm{C}$
 * Letters now denote italic letters, while digits and punctuation denote roman digits and punctuation.
 * Units which consist of two parts (with no operation between them, e.g., \cdot) should be separated with a hyphen when abbreviated, e.g. kg-wt. $$10.15\,\textrm{kg-wt}$$ $10.15\,$kg-wt

LaTeX
The feature that makes LaTeX the right editing tool for scientific documents is the ability to render complex mathematical expressions.

The simplest formula is a single letter, like ‘x’, or a single number, like ‘2’. In order to put these into a TEX text, you type ‘$x$’ and ‘$2$’, respectively. Notice that all mathematical formulae are enclosed in special math brackets; When you type ‘$x$’ the ‘x’ comes out in italics, but when you type ‘$2$’ the ‘2’ comes out in roman type. In general, all characters on your keyboard have a special interpretation in math formulae. According to the Typographical conventions in mathematical formulae, a hyphen (-) now denotes a minus sign (−), which is almost the same as an em-dash but not quite. The ﬁrst $ that you type puts you into “math mode” and the second takes you out. So if you forget one $ or type one $ too many, TEX will probably get confused and you will give some sort of an error message.

Nearly all mathematical items, such as variables, expressions, equations, etc., should be written in math mode. In fact, most math will generate errors if you don't remember to put it in math mode.

LaTeX allows two writing modes for mathematical expressions: the inline mode and the display mode. The first one is used to write formulae that are parts of a text. The second one is used to write expressions that are not a part of a text or paragraph, and are therefore put on separate lines.

LaTeX modes
TeX has three basic modes: a text mode, used for typesetting ordinary text, and two types of math modes, an ordinary math mode for math formulae set "inline", and a display math mode, used for displayed math formulae. At any given point during the processing of a document, TeX is in one of those three modes.


 * 1) Text mode This is the normal, or default, mode of TeX. TeX stays in that mode unless it encounters a special instruction that causes it to switch to one of the math modes, and it returns to text mode following a corresponding instruction that indicates the end of math mode.
 * 2) Ordinary (inline) math mode Mathematical material to be typeset inline must be surrounded by single dollar signs. For example: "$a^2 + b^2 = c^2$". The single dollar signs surrounding this expression cause TeX to enter and exit (ordinary) math mode.
 * 3) Display math mode Material that is surrounded by a pair of dollar signs, or by "equation environments" such as \begin{align} ... \end{align}, is being processed by TeX in "display math mode." This means that the expression enclosed gets displayed on a separate line (or several lines, in case of multiline equations). Longer mathematical formulae and numbered formulae are usually "displayed" in this manner. Note that the commands for entering and leaving display math mode are distinct, a double dollar sign ($$) is used to indicate the beginning and end of display math mode.

Mathematical Symbols
While most plain text can be typed as it appears, there are a number of symbols which have a special meaning to TEX or which for technical reasons cannot be typed in the usual way.

To type these symbols, we need to use control sequences. A control sequence (or macro) is a word in your input file which is not interpreted as text to be typeset as it appears, but is instead an instruction to TEX to take some particular action. The simplest of these just instruct TEX to print some particular symbol which cannot be typed directly. Almost all control sequences consist of a \ character followed by either of a word or a single special symbol. Here are some macros for generating textual symbols:


 * Arithmetic operators


 * Equality signs


 * Comparison


 * Elementary Functions


 * Complex numbers


 * Constants


 * Sequences and series


 * Set construction


 * Set operations


 * Set Relations


 * Number sets


 * Functions


 * Combinatorics


 * Trigonometric functions


 * Limits


 * Integration


 * Arithmetic Mean


 * Regression


 * Trigonometry


 * Probability


 * Differential Calculus


 * Elementary Geometry


 * Different formulae For the questions that ask for completing a number with missing digits, we use \box preceded by thin space and followed by thin space. For example: $$3\,\Box\,56\,\Box\,9$$ $3\,\Box\,56\,\Box\,9$  We can also use \cdots instead of the missing digit, but this is only applicable in grades lower than the seventh grade. For example:  $$3\cdots56\cdots9$$ $3\cdots56\cdots9$