General2 more math questions

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Snoop1990
Posts: 5
Joined: Fri Mar 28, 2008 2:46 pm

2 more math questions

Post by Snoop1990 »

Hey,
I have two more math question.

1. I want to write an arrow with a function name above:
I first tried

Code: Select all

\rightarrow^f
but this places the f at the end not in the middle. So I tried

Code: Select all

\stackrel{f}{\rightarrow}
now it is up and in the middle but it should be a bit smaller. I guess I am just missing some function, so please help.

2. I want to define a function that is not constantly:

Code: Select all

|x| := \begin{Bmatrix}x & for &x \leq 0 \\-x & for& x<0\end{matrix}
This worked with my last LaTeX Render, but now he complains about the \end tag. But I do not want the bracket at the end. So again I guess there is a command I do not know ...

I am sorry but I am no native speaker therefore my english especially when it comes to mathematical expressions is bad, hope you understand what I am looking for if not, feel free to ask.

Regrades Snoop1990
Snoop1990.uni.cc (personal blog)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

shmill
Posts: 3
Joined: Wed Jun 18, 2008 3:35 pm

2 more math questions

Post by shmill »

[quote="Snoop1990"]Hey,
I have two more math question.

1. I want to write an arrow with a function name above:
I first tried

Code: Select all

\rightarrow^f
but this places the f at the end not in the middle. So I tried

Code: Select all

\stackrel{f}{\rightarrow}
now it is up and in the middle but it should be a bit smaller. I guess I am just missing some function, so please help.


try \buildrel{f}\over{\rightarrow}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

2 more math questions

Post by localghost »

The first solution works with standard LaTeX. For the second one you have to include the (preferably to use) amsmath package.
  1. You can control the font size in math mode. Just add a suitable command.

    Code: Select all

    \[
      \stackrel{\scriptstyle f}{\longrightarrow}
    \]
    
    Refer to basic LaTeX documentation to learn more about sizes in displayed mode.
  2. Use the cases environment to get what you want.

    Code: Select all

    \[
      |x| := \begin{cases}\hphantom{-}x & \text{for}\quad x\geq 0 \\-x & \text{for}\quad x<0\end{cases}
    \]
    I added a virtual "-" to get a proper alignment.
More about typesetting mathematical expressions can be found in "Math mode".


Best regards
Thorsten¹
Snoop1990
Posts: 5
Joined: Fri Mar 28, 2008 2:46 pm

2 more math questions

Post by Snoop1990 »

localghost wrote:...
Thank you very much that is exactly what I was looking for !

Regrades Snoop1990
Snoop1990.uni.cc (personal blog)
Post Reply