Difference between revisions of "Comments:LaTeX-tips font size color box and math"

From GeoGebra Manual
Jump to: navigation, search
(Created page with "GeoGebra use ''JLaTeXMath'' (a powerful ally) to show mathematical formulas (text and symbols) using LaTeX. The first thing to remember is that LaTeX works in two modes '''text...")
 
Line 1: Line 1:
 
GeoGebra use ''JLaTeXMath'' (a powerful ally)  to show mathematical formulas  (text and symbols) using LaTeX.
 
GeoGebra use ''JLaTeXMath'' (a powerful ally)  to show mathematical formulas  (text and symbols) using LaTeX.
The first thing to remember is that LaTeX works in two modes '''text mode''' and '''math mode'''. Enter text must be in '''text mode''' and  writing mathematical in [b]math mode[/b].
+
The first thing to remember is that LaTeX works in two modes '''text mode''' and '''math mode'''. Enter text must be in '''text mode''' and  writing mathematical in '''math mode'''.
  
 
By default when checking the box "LaTeX formula" that enters '''math mode'''(font in italic), if we enter text (roman font) must switch to '''text mode''' by typing:<code>\text{text text text}</code>or <code>\mbox{text text text}</code>
 
By default when checking the box "LaTeX formula" that enters '''math mode'''(font in italic), if we enter text (roman font) must switch to '''text mode''' by typing:<code>\text{text text text}</code>or <code>\mbox{text text text}</code>
 
== Fonts==
 
== Fonts==
 
=== Font size===
 
=== Font size===
The size of the fonts can be changed globally with the following commands:<code>\tiny
+
The size of the fonts can be changed globally with the following commands:
\scriptsize
+
<center>
\footnotesize
+
{| class="pretty"
\small
+
|\tiny || \scriptsize || \footnotesize ||\small ||\normalsize
\normalsize
+
|-
\large
+
|\large || \Large || \LARGE ||\huge ||\Huge  
\Large
+
|}
\LARGE
+
</center>
\huge
+
The  command '''\normalsize'''  back font to its original size. If you want to combine different font sizes should add the commands in braces {...}.
\Huge </code>
+
 
The  command '''\normalsize'''  back font to its original size. If you want to combine different font sizes should add the commands in braces {...}. This is an example of combination of sizes in '''math mode''':
+
This is an example of combination of sizes in '''math mode''':
<code>{\scriptsize A}{\footnotesize B}{\small C}{\normalsize D}{\large E}{\Large F}{\LARGE G}{\huge H}{\Huge I}</code>
+
{{Example| 1= <code><nowiki>{\scriptsize A}{\footnotesize B}{\small C}{\normalsize D}{\large E}{\Large F}{\LARGE G}{\huge H}{\Huge I}</nowiki></code>}}
This is an example of combination of sizes in text/math mode using [b]\oldstylenums{ ...}[/b] command (only math mode):
+
This is an example of combination of sizes in text/math mode using '''\oldstylenums{ ...}''' command (only math mode):
<code>\text{{\Huge GeoGebra}, the most powerful, {\small since }}\oldstylenums{ 2001-2012}</code>
+
{{Example| 1= <code><nowiki>\text{{\Huge GeoGebra}, the most powerful, {\small since }}\oldstylenums{ 2001-2012}</nowiki></code>}}
 
We can also use the command in  text/math mode:<code>\scalebox{h_scale}[v_scale]{...}</code> where '''{h_scale}''' is a positive(negative) number (mandatory) and  '''[v_scale]''' is a positive number (optional), numbers can be sliders.
 
We can also use the command in  text/math mode:<code>\scalebox{h_scale}[v_scale]{...}</code> where '''{h_scale}''' is a positive(negative) number (mandatory) and  '''[v_scale]''' is a positive number (optional), numbers can be sliders.
for example:<code>\scalebox{2}{\text{{\Huge GeoGebra}, the most powerful, {\small since }}\oldstylenums{ 2001-2012}}</code>
+
{{Example| 1= <code><nowiki>\scalebox{2}{\text{{\Huge GeoGebra}, the most powerful, {\small since }}\oldstylenums{ 2001-2012}}</nowiki></code>}}
 
===Font Family===
 
===Font Family===
 
In '''text mode''' we have the following families of text, we can use globally or using braces {...}: <code>\rm or {\rm }
 
In '''text mode''' we have the following families of text, we can use globally or using braces {...}: <code>\rm or {\rm }
 
\sf or {\sf }
 
\sf or {\sf }
\tt or {\tt }</code> This is an example:
+
\tt or {\tt }</code>
<code>\text{{\rm GeoGebra}{\sf ,the most powerful}, {\tt since }}\oldstylenums{ 2001-2012}</code> In '''math mode''' we have the following families (default mathrm): <code>\mathcal{ABC}
+
This is an example:
\mathrm{abc}
+
{{Example| 1= <code><nowiki>\text{{\rm GeoGebra}{\sf ,the most powerful}, {\tt since }}\oldstylenums{ 2001-2012}</nowiki></code>}}
\mathbf{abc}
+
 
\mathsf{abc}
+
In '''math mode''' we have the following families (default mathrm):  
\mathit{abc}
+
<center>
\mathtt{abc}
+
{| class="pretty"
\mathfrak{abc}
+
|\mathcal{ABC} || \mathrm{abc} || \mathbf{abc} || \mathsf{abc} ||\mathit{abc}
\mathbb{ABC}
+
|-
\mathscr{ABC}</code> For example:<code>\mathbb{G}\mathfrak{e}\mathbf{o}\mathsf{G}\mathscr{E}\mathtt{b}\mathrm{a}</code>
+
|\mathtt{abc} || \mathfrak{abc} || \mathbb{ABC} || \mathscr{ABC}
 +
|}
 +
</center>
 +
 
 +
{{Example| 1= <code><nowiki><code>\mathbb{G}\mathfrak{e}\mathbf{o}\mathsf{G}\mathscr{E}\mathtt{b}\mathrm{a}</nowiki></code>}}
 
=== Font Series===
 
=== Font Series===
 
For '''text mode''' use '''\bf''' or '''{\bf ...}''' and for '''math mode''' use '''\mathbf{...}''',
 
For '''text mode''' use '''\bf''' or '''{\bf ...}''' and for '''math mode''' use '''\mathbf{...}''',
 
{{Example| 1= <code><nowiki>\text{\bf GeoGebra }\mathbf{\sqrt{2012^{2}}}</nowiki></code>}}
 
{{Example| 1= <code><nowiki>\text{\bf GeoGebra }\mathbf{\sqrt{2012^{2}}}</nowiki></code>}}
 
=== Font Shapes===
 
=== Font Shapes===
For Small Caps in [b]text mode[/b] use:<code>\text{{\sc GeoGebra} or \textsc{GeoGebra}</code>
+
For Small Caps in '''text mode''' use:<code>\text{{\sc GeoGebra} or \textsc{GeoGebra}</code>
 +
 
 
==Quotation marks==
 
==Quotation marks==
 
Straight quotes "..." is a special character for GeoGebra, should never be used directly in LaTeX.
 
Straight quotes "..." is a special character for GeoGebra, should never be used directly in LaTeX.
For a single quotation marks in [b]text mode[/b] use:
+
For a single quotation marks in '''text mode''' use:
<code>\text{`Simple'}</code> and for double quotation marks use:<code>\text{``Doble''}</code>
+
<code><nowiki>\text{'Simple'}</nowiki></code> and for double quotation marks use:<code><nowiki>\text{''Doble''}</nowiki></code>
 +
 
 
For more info see http://www.geogebra.org/forum/viewtopic.php?f=8&t=20512&p=77283&hilit=quotes#p77283
 
For more info see http://www.geogebra.org/forum/viewtopic.php?f=8&t=20512&p=77283&hilit=quotes#p77283
 +
 
==Horizontal space.==
 
==Horizontal space.==
For a single spaced in [b]text mode[/b] use the space bar for other spaces we have the following commands:<code>\quad
+
For a single spaced in '''text mode''' use the space bar for other spaces we have the following commands:<code>\quad
 
\qquad
 
\qquad
\hspace{...}</code> The command [b]\hspace{...}[/b] (and [b]\quad[/b], [b]\qquad[/b] also available in [b]math mode[/b]) supports the following units of measurement (positive and negative) :<code>pt  point         (1 in = 72.27 pt)
+
\hspace{...}</code>
pc pica         (1 pc = 12 pt)
+
 
in  inch         (1 in = 25.4 mm)
+
The command '''\hspace{...}''' (and '''\quad''', '''\qquad''' also available in '''math mode''') supports the following units of measurement (positive and negative) :
bp big point     (1 in = 72 bp)
+
<center>
cm centimetre   (1 cm = 10 mm)
+
{| class="pretty"
mm  millimetre
+
|pt  ||point     ||    (1 in = 72.27 pt) ||pc || pica     ||    (1 pc = 12 pt)
dd didot point   (1157 dd = 1238 pt)
+
|-
sp scaled point  (65536 sp = 1 pt)</code> In math mode we have the following commands:<code>\, a small space
+
|in|| inch   ||      (1 in = 25.4 mm)||bp || big point   ||  (1 in = 72 bp)
\: a medium space
+
|-
\; a large space
+
|cm || centimetre ||  (1 cm = 10 mm) ||mm|| millimetre
\! a negative space (moves things back to the left) </code>
+
|-
 +
|dd || didot point || (1157 dd = 1238 pt)||sp || scaled point  ||(65536 sp = 1 pt)
 +
|}
 +
</center>
 +
In math mode we have the following commands:
 +
<center>
 +
{| class="pretty"
 +
|\, || a small space || \: || a medium space || \; || a large space || \! || a negative space (moves things back to the left)
 +
|}
 +
</center>
 +
 
 
==Boxes and Color (In both modes)==
 
==Boxes and Color (In both modes)==
 +
 
===Text and Math in Color ===
 
===Text and Math in Color ===
The colors supported directly by [i]JLaTeXMath[/i] can be found in http://en.wikibooks.org/wiki/LaTeX/Colors#The_68_standard_colors_known_to_dvips
+
 
you can use the command:<code>\textcolor{color}{...}</code> for example: <code>\text{\textcolor{WildStrawberry}{Geo}\textcolor{blue}{G}\textcolor{red}{ebra}}\,\textcolor{green}{\oldstylenums{4.2}</code>
+
The colors supported directly by ''JLaTeXMath'' can be found in http://en.wikibooks.org/wiki/LaTeX/Colors#The_68_standard_colors_known_to_dvips
 +
you can use the command:<code>\textcolor{color}{...}</code>
 +
 
 +
{{Example| 1= <code><nowiki>\text{\textcolor{WildStrawberry}{Geo}\textcolor{blue}{G}\textcolor{red}{ebra}}\,\textcolor{green}{\oldstylenums{4.2}</nowiki></code>}}
 +
 
 
=== Frame Boxes===
 
=== Frame Boxes===
 +
 
For simple frame boxes (no colors) use :<code>\boxed{2012\text{ is now!}</code> or<code>\fbox{2012\text{ is now!}</code>
 
For simple frame boxes (no colors) use :<code>\boxed{2012\text{ is now!}</code> or<code>\fbox{2012\text{ is now!}</code>
 +
 
=== Color Boxes===
 
=== Color Boxes===
 +
 
A. For a color box (same color in border and background) use:<code>\colorbox{red}{2012\text{ is now!}</code>
 
A. For a color box (same color in border and background) use:<code>\colorbox{red}{2012\text{ is now!}</code>
 +
 
B. For a color box (diferent color in border and background) use:<code>\fcolorbox{blue}{red}{2012\text{ is now!}</code>
 
B. For a color box (diferent color in border and background) use:<code>\fcolorbox{blue}{red}{2012\text{ is now!}</code>
 +
 
=== Rotate Boxes===
 
=== Rotate Boxes===
If you need to rotate a box (or whatever) use:<code>\rotatebox{angle}{...}</code> For example:<code>\rotatebox{45}{\fcolorbox{blue}{red}{2012\text{ is now!}}</code>
+
 
 +
If you need to rotate a box (or whatever) use:<code>\rotatebox{angle}{...}</code>  
 +
 
 +
{{Example| 1= <code><nowiki>\rotatebox{45}{\fcolorbox{blue}{red}{2012\text{ is now!}}</nowiki></code>}}
 +
 
 
=== Reflect Boxes===
 
=== Reflect Boxes===
If you need to reflect a box (or whatever) use:<code>\reflectbox{...}</code> For example:<code>\reflectbox{\fcolorbox{blue}{red}{2012\text{ is now!}}</code>
+
 
 +
If you need to reflect a box (or whatever) use:<code>\reflectbox{...}</code>
 +
{{Example| 1= <code><nowiki>\reflectbox{\fcolorbox{blue}{red}{2012\text{ is now!}}</nowiki></code>}}
 +
 
 
===Phantom Boxes===
 
===Phantom Boxes===
Sometimes it is necessary to have these phantom boxes,for systems, control the height under a root, alignment on a formula, etc. It has these three commands:<code>\phantom{XXX} space as wide and high as three X’s
+
 
\hphantom{XXX} space as wide as three X’s; height 0
+
Sometimes it is necessary to have these phantom boxes,for systems, control the height under a root, alignment on a formula, etc.
\vphantom{X} space of width 0, height = height of X</code> For example:<code>\sqrt{b}+\sqrt{\vphantom{b}a}</code>
+
 
 +
It has these three commands:
 +
<center>
 +
{| class="pretty"
 +
|\phantom{XXX} || space as wide and high as three X’s
 +
|-
 +
|\hphantom{XXX} ||space as wide as three X’s; height 0
 +
|-
 +
|\vphantom{X} || space of width 0, height = height of X
 +
|}
 +
</center>
 +
{{Example| 1= <code><nowiki>\sqrt{b}+\sqrt{\vphantom{b}a}</nowiki></code>}}
 +
 
 
I think that's all for now, in the future (if I have time) will write a little about tables and matrices.
 
I think that's all for now, in the future (if I have time) will write a little about tables and matrices.
[i]JLaTeXMath[/i] supports many mathematical environments (whitout *) I recommend reading ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf
+
''JLaTeXMath'' supports many mathematical environments (whitout *) I recommend reading ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf
 
If other forum users wish to contribute with examples (math environments) would be great.
 
If other forum users wish to contribute with examples (math environments) would be great.
 
Saludos
 
Saludos
 
Pablo.
 
Pablo.
PS:I did not know whether to write here or in Using GeoGebra...
 

Revision as of 19:23, 10 March 2012

GeoGebra use JLaTeXMath (a powerful ally) to show mathematical formulas (text and symbols) using LaTeX. The first thing to remember is that LaTeX works in two modes text mode and math mode. Enter text must be in text mode and writing mathematical in math mode.

By default when checking the box "LaTeX formula" that enters math mode(font in italic), if we enter text (roman font) must switch to text mode by typing:\text{text text text}or \mbox{text text text}

Fonts

Font size

The size of the fonts can be changed globally with the following commands:

\tiny \scriptsize \footnotesize \small \normalsize
\large \Large \LARGE \huge \Huge

The command \normalsize back font to its original size. If you want to combine different font sizes should add the commands in braces {...}.

This is an example of combination of sizes in math mode:

Example: {\scriptsize A}{\footnotesize B}{\small C}{\normalsize D}{\large E}{\Large F}{\LARGE G}{\huge H}{\Huge I}

This is an example of combination of sizes in text/math mode using \oldstylenums{ ...} command (only math mode):

Example: \text{{\Huge GeoGebra}, the most powerful, {\small since }}\oldstylenums{ 2001-2012}

We can also use the command in text/math mode:\scalebox{h_scale}[v_scale]{...} where {h_scale} is a positive(negative) number (mandatory) and [v_scale] is a positive number (optional), numbers can be sliders.

Example: \scalebox{2}{\text{{\Huge GeoGebra}, the most powerful, {\small since }}\oldstylenums{ 2001-2012}}

Font Family

In text mode we have the following families of text, we can use globally or using braces {...}: \rm or {\rm } \sf or {\sf } \tt or {\tt } This is an example:

Example: \text{{\rm GeoGebra}{\sf ,the most powerful}, {\tt since }}\oldstylenums{ 2001-2012}


In math mode we have the following families (default mathrm):

\mathcal{ABC} \mathrm{abc} \mathbf{abc} \mathsf{abc} \mathit{abc}
\mathtt{abc} \mathfrak{abc} \mathbb{ABC} \mathscr{ABC}
Example: <code>\mathbb{G}\mathfrak{e}\mathbf{o}\mathsf{G}\mathscr{E}\mathtt{b}\mathrm{a}

Font Series

For text mode use \bf or {\bf ...} and for math mode use \mathbf{...},

Example: \text{\bf GeoGebra }\mathbf{\sqrt{2012^{2}}}

Font Shapes

For Small Caps in text mode use:\text{{\sc GeoGebra} or \textsc{GeoGebra}

Quotation marks

Straight quotes "..." is a special character for GeoGebra, should never be used directly in LaTeX. For a single quotation marks in text mode use: \text{'Simple'} and for double quotation marks use:\text{''Doble''}

For more info see http://www.geogebra.org/forum/viewtopic.php?f=8&t=20512&p=77283&hilit=quotes#p77283

Horizontal space.

For a single spaced in text mode use the space bar for other spaces we have the following commands:\quad \qquad \hspace{...}

The command \hspace{...} (and \quad, \qquad also available in math mode) supports the following units of measurement (positive and negative) :

pt point (1 in = 72.27 pt) pc pica (1 pc = 12 pt)
in inch (1 in = 25.4 mm) bp big point (1 in = 72 bp)
cm centimetre (1 cm = 10 mm) mm millimetre
dd didot point (1157 dd = 1238 pt) sp scaled point (65536 sp = 1 pt)

In math mode we have the following commands:

\, a small space \: a medium space \; a large space \! a negative space (moves things back to the left)

Boxes and Color (In both modes)

Text and Math in Color

The colors supported directly by JLaTeXMath can be found in http://en.wikibooks.org/wiki/LaTeX/Colors#The_68_standard_colors_known_to_dvips you can use the command:\textcolor{color}{...}

Example: \text{\textcolor{WildStrawberry}{Geo}\textcolor{blue}{G}\textcolor{red}{ebra}}\,\textcolor{green}{\oldstylenums{4.2}


Frame Boxes

For simple frame boxes (no colors) use :\boxed{2012\text{ is now!} or\fbox{2012\text{ is now!}

Color Boxes

A. For a color box (same color in border and background) use:\colorbox{red}{2012\text{ is now!}

B. For a color box (diferent color in border and background) use:\fcolorbox{blue}{red}{2012\text{ is now!}

Rotate Boxes

If you need to rotate a box (or whatever) use:\rotatebox{angle}{...}

Example: \rotatebox{45}{\fcolorbox{blue}{red}{2012\text{ is now!}}


Reflect Boxes

If you need to reflect a box (or whatever) use:\reflectbox{...}

Example: \reflectbox{\fcolorbox{blue}{red}{2012\text{ is now!}}


Phantom Boxes

Sometimes it is necessary to have these phantom boxes,for systems, control the height under a root, alignment on a formula, etc.

It has these three commands:

\phantom{XXX} space as wide and high as three X’s
\hphantom{XXX} space as wide as three X’s; height 0
\vphantom{X} space of width 0, height = height of X
Example: \sqrt{b}+\sqrt{\vphantom{b}a}


I think that's all for now, in the future (if I have time) will write a little about tables and matrices. JLaTeXMath supports many mathematical environments (whitout *) I recommend reading ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf If other forum users wish to contribute with examples (math environments) would be great. Saludos Pablo.

© 2024 International GeoGebra Institute