Help with LaTeX

1. Feb 8, 2008

Kebaan

I'm using texmaker, and i need to explain how to use some of the functions.

Therefore i need to be able to write the codes in a way so that the reader can see the codes afterwards.

Does anyone know how to do that? Because i can't find a way to do it.

2. Feb 8, 2008

Staff: Mentor

Last edited: Feb 8, 2008
3. Feb 8, 2008

Kebaan

thanks for the answer but it wasnt exactly what i needed.

for example when I have to make a fraction like this:
\frac{x}{y}
I need to show the teacher how i made the fraction by showing him the code, in the .PDF document.

4. Feb 8, 2008

Hootenanny

Staff Emeritus
If you type;

\begin{verbatim}
\frac{x}{y}
\end{verbatim}

LaTeX will render it as something of the form,

Code (Text):
\frac{x}{y}
As opposed to,

$$\frac{x}{y}$$

5. Feb 8, 2008

cristo

Staff Emeritus
You can type \verb|\frac{x}{y}| to get latex to show something that looks like the input text.

Edit: Looks like I've been beaten to it.. feels like deja vu!

6. Feb 8, 2008

kdv

I have used the verbatim environment but the code then shows up on a separate line. Is there a way to do this with the code appearing on a text line?

7. Feb 8, 2008

Kebaan

I have tested both possibilities and both of them is working for me. Thank you =D

8. Feb 8, 2008

Hootenanny

Staff Emeritus
No problem
cristo's suggestion produces inline verbatim text. Note that you can chose whichever characters you like (except "\" and "%") as your delimiter, in this case cristo has chosen "|", but you could equally well chose any other character, e.g. "£", "!", "/",... However, your delimiter cannot appear in your verbatim text as it will serve to close the verbatim environment.

Last edited: Feb 8, 2008