Any ideas of how to represent a list in pseudo-code in LaTex?

In summary, the conversation involves a person seeking help in representing a list data structure in pseudo-code using LaTeX. They have searched through standard algorithmic packages but have not found any information on lists. They are looking for examples of diagrams used in publications for guidance and potentially using solutions from other authors' TeX source codes.
  • #1
uwowizard
14
0
I'm working with the algorithmic and algorithm packages in LaTeX and looking for a way to perform some operations on a list in the algorithm.. Any ideas how I can do that? Any advice is highly appreciated.

Thank you in advance.
 
Physics news on Phys.org
  • #2
Can't really get what you ask about...

Do you ask how to print list structures (boxes with dots and arrows) in LaTeX?

Or maybe you are a fan of Dirty Tricks and ask how to port some Lisp program to [itex]\TeX[/itex]? - if so - be more specific what you want to do.
 
  • #3
I'm looking for a standard way to represent a list (data structure) in pseudo-code. I looked at the documentation of standard algorithmic packages in latex, e.g.

http://en.wikibooks.org/wiki/LaTeX/Algorithms_and_Pseudocode

but could find anything about lists.

Pls, let me know if I need to be more clear.
 
  • #4
In particular, I want to be able to represent the following operations

list l
l.add(l1,i) //add element l1 in the i-th position
l.remove(j) // remove an element in the j-th position
 
  • #5
I am not familiar with publications about list processing, so could you give an example of any (available online) paper, where such diagrams are used and printed in a manner you want to achieve?

BTW: for many papers you may retrieve not only pdf, but also TeX source, so you may steal the solution from other author
 

Related to Any ideas of how to represent a list in pseudo-code in LaTex?

1. What is pseudo-code and how is it useful for representing a list in LaTex?

Pseudo-code is a simplified version of a programming language used to describe algorithms and logic without using specific syntax. It is useful for representing a list in LaTex because it allows for easier understanding and translation of code for different programming languages.

2. How do you create a list in pseudo-code in LaTex?

To create a list in pseudo-code in LaTex, you can use the \begin{algorithmic} and \end{algorithmic} tags and then use the \STATE command before each item on the list. Alternatively, you can use the \FOR or \WHILE commands to create a loop that lists out each item in the list.

3. Can you give an example of how to represent a list in pseudo-code in LaTex?

Sure, here is an example of a list in pseudo-code using the \begin{algorithmic} and \end{algorithmic} tags:

\begin{algorithmic}\STATE Item 1\STATE Item 2\STATE Item 3\end{algorithmic}

This would output:

1. Item 1

2. Item 2

3. Item 3

4. Are there any specific formatting rules to follow when representing a list in pseudo-code in LaTex?

Yes, there are a few formatting rules to follow when representing a list in pseudo-code in LaTex. Each item on the list should be preceded by the \STATE command, and the list should be enclosed in the \begin{algorithmic} and \end{algorithmic} tags. Additionally, you should use indentation to show hierarchy and use appropriate keywords such as \FOR, \WHILE, or \IF to indicate loops and conditional statements.

5. Can you use numbered and bullet lists in pseudo-code in LaTex?

Yes, you can use both numbered and bullet lists in pseudo-code in LaTex. To create a numbered list, use the \STATE command before each item on the list. To create a bullet list, use the \STATE* command before each item on the list. You can also use the \FOR or \WHILE commands to create a loop that lists out each item with the appropriate numbering or bullet points.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
975
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
23
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • Feedback and Announcements
Replies
11
Views
356
Back
Top