Explaining Texmaker Functions for Code Output

Click For Summary

Discussion Overview

The discussion revolves around using Texmaker and LaTeX to display code in a way that allows readers to see the actual code used for formatting mathematical expressions, specifically fractions. Participants explore methods to achieve this in a PDF document.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Homework-related

Main Points Raised

  • One participant seeks guidance on how to display LaTeX code in a PDF document, specifically for fractions.
  • Another participant suggests using the \begin{verbatim}...\end{verbatim} environment to show the code, but notes that it appears on a separate line.
  • A different approach is proposed using \verb|...| to display the code inline, allowing for flexibility in choosing delimiters.
  • Some participants confirm that both methods work for them, expressing satisfaction with the solutions provided.
  • There is a mention of a sticky thread in the Tutorial forum about using LaTeX, indicating a resource for further information.

Areas of Agreement / Disagreement

Participants generally agree on the methods suggested for displaying code, but there is no consensus on the preferred approach for inline versus block display of code.

Contextual Notes

Some limitations include the need for specific delimiters in the verbatim environment and the potential for confusion regarding the display format of the code.

Who May Find This Useful

This discussion may be useful for users of Texmaker and LaTeX who are looking to present their code clearly in documents, particularly in educational contexts.

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.
 
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,

\frac{x}{y}
 
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,

\frac{x}{y}

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:

Similar threads

  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 15 ·
Replies
15
Views
8K