Explaining Texmaker Functions for Code Output

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
7 replies · 3K views
Kebaan
Messages
6
Reaction score
0
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.
 
Physics news on Phys.org
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.
 
Kebaan said:
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.

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!
 
Hootenanny said:
If you type;

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

LaTeX will render it as something of the form,

Code:
\frac{x}{y}

As opposed to,

[tex]\frac{x}{y}[/tex]

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?
 
I have tested both possibilities and both of them is working for me. Thank you =D
 
Kebaan said:
I have tested both possibilities and both of them is working for me. Thank you =D
No problem :smile:
kdv said:
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?
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.
cristo said:
You can type \verb|\frac{x}{y}| to get latex to show something that looks like the input text.
 
Last edited: