The tag has no wiki summary.

learn more… | top users | synonyms

2
votes
1answer
26 views

How should multiline pieces of code be put into a table?

I have the following two pieces of information that I would like to present side-by-side in a Beamer slide. I think I'd like these two things in two cells of a two-column table. Is there a good way to ...
3
votes
1answer
79 views

Undefined control sequence in Latex using programming code

Problem: Getting the error message Undefined control sequence. (\end{document}..). This occurs when I include the following code that prints out formatted programming code. If I remove this code the ...
5
votes
3answers
66 views

Centered line code with numbering

How I can center a line code and numbering it like in the picture? Is there a command that works inside a lstlisting environment? Really thanks in advance
0
votes
0answers
10 views

How to write “for” block with counter by Algorithmic package

How can I write a code like below using algorithmic package for (int i = 0; i < node.children; ++i) ..... I can't use foreach or forall because in a point inside the loop I should decrement i ...
1
vote
0answers
44 views

why is the text green in my code listing? [closed]

I use \begin{lstlisting} Type readable_t, writable_t \end{lstlisting} I want the text color to be black, but instead I get green:
3
votes
1answer
64 views

Exclude lstinputlisting

I want to save paper when I print my LaTeX file. That's why I want to hide all my code, inserted wtih lstinputlisting{} I already know how to exclude tables and images or math but the ...
0
votes
0answers
21 views

Defining keywords for SQL using listings

Problem: I use listings package to highlight SQL code but for some reason, unknown to me, I can't get certain keywords in SQL to highlight in a different color. Minimal Working Example: ...
1
vote
1answer
59 views

Macro/shortcut for defining text portion as code

I'm currently converting my thesis into LaTeX, and i have an issue: being an IT thesis, I have tons of code quotes. The problem is not about the blocks of code: they are not that many and i can wrap ...
1
vote
1answer
25 views

Add description to code tag

I didn't find answer how to add description to my simple code listing. It looks like that: \lstnewenvironment{code}[1][]% { \noindent \minipage{\linewidth} \vspace{0.5\baselineskip} ...
3
votes
1answer
42 views

How to indent formula in two different lines

Please see the uploaded photo. The formula is too long, so I have to let it breaks to the second line. However I want to indent the two formulas, so what should I do ? Please help me. Thanks.
1
vote
0answers
22 views

Is there any smart way to dynamically define lines in listing? [duplicate]

I'm using lstinputlisting to include code examples in my thesis, but as I'm working on the text and the code simultaneously, the code is not yet fixed in length. Is there any way that I can define a ...
0
votes
1answer
21 views

Set italic and bold inside of \lstlisting

The following effect is what I want: And I wrote corresponding code as below \begin{lstlisting}[mathescape] \textbf{Document} ::= <Document [\textbf{\emph{documentName}}]$_0^1$ ...
0
votes
0answers
25 views

Insert BNF to paper [duplicate]

I want insert the following BNF into my paper.And I wrote corresponding code as below. The following code has many problem and can't work. I think there must be some simpler ways to implement. ...
0
votes
0answers
24 views

Insert XML code to paper [duplicate]

I use the following set to insert xml code to paper \usepackage{listings} \usepackage{color} \definecolor{gray}{rgb}{0.4,0.4,0.4} \definecolor{darkblue}{rgb}{0.0,0.0,0.6} ...
4
votes
2answers
140 views

Aligning table within latex editor

Suppose I have the following table in my TeXstudio editor: Latex & 360 & 101.77 & 10.71 & 101.86 & 64.60 & 127.20 \\ Manufacturing & 360 & -7.33 & 12.59 ...
11
votes
3answers
360 views

End \verbatim command

The verbatim environment is used to display LaTeX commands instead of having them executed. To display a single command in-line, the \verb|| command can be used. To display a whole block, we can use ...
2
votes
0answers
55 views

How to write the signature of a method in LaTex?

I'm writing an article in LaTex about programming and I need to write the signature of a C++ method using a specific format, only the statement of the method, not the body. for example: void ...
1
vote
1answer
70 views

Define starting line number when using mcode.sty to display Matlab code and referring to the code

I want to include parts of my Matlab code in my LaTeX document using mcode.sty. Here's a MWE: \documentclass[b5paper, 10pt, twoside, openright, dvipsnames,cmyk]{report} \usepackage{listings} % Is ...
1
vote
2answers
31 views

Rotate code on file in lateX document

I want to include a file with Haskell code to my LaTeX document. Unfortunately, the code taking to much space, so I wanted to rotate it to have a landscape format, but somewhat, the code is almost ...
1
vote
0answers
74 views

Good looking LaTeX code [duplicate]

I'm looking for some script (program) which would help in editing LaTeX code. Usually I have a mess in my .tex code, so it would be good if the script could align tabulars and so on. It would also be ...
3
votes
0answers
58 views

How make formulas in the PDF not selectable?

Mathematical formulas in a PDF from LaTex generate lots of noise while reading it with Text-to-speech software. This is why I would like find a way to make all the set of symbols inside the formulas ...
5
votes
1answer
91 views

Referring with cleveref to a custom listing (\lstnewenvironment)

I use cleveref's \cref command for referencing, and \lstnewenvironment to create a new listing type. My document has multiple types of listings, each of them with their own counter. However, cleveref ...
3
votes
1answer
66 views

Non-curly quotes in code?

Here is a quick question, how to use tex to print this ' symbol? An example is shown below: data 'a list = Nil | Cons (e, 'a list) I tried to use ' or `, but they all looks bad.. I am sorry but I ...
3
votes
1answer
44 views

Backwards quotes in embedded C code

I used the csquotes package to make all double quotes curl the right way in the body of my document, but in the embedded code it doesn't work. I tried the slanted quotes and they don't work either. ...
2
votes
1answer
69 views

bound width of a single lstlisting to one column inside a two column IEEE template

I use IEEE double column template and inside it I add a C++ code. I expect the code to be bounded within a single column however it infringes to the next column. How to fix this code? I would avoid ...
9
votes
1answer
607 views

What is this code fragment for?

Taking a look at the code of the package ifxetex, I found the following: \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname ProvidesPackage\endcsname\relax\else ...
2
votes
0answers
87 views

How to transform a mathematical expression from LaTeX code to Maxima code?

How to transform a mathematical expression from LaTeX code to Maxima code? For example, convert \frac{8x^3-4x-2}{2x} in LaTeX to (8*x^3-4*x-2)/(2*x) in Maxima, but automatically.
0
votes
2answers
219 views

How to include lambda calculus code in LaTeX?

What is the best way to include lambda calculus code in LaTeX (like in Courier new font), especially one that allows for the use of math symbols as well like $\lambda$ throughout the environment. For ...
2
votes
1answer
96 views

Maple 18 output in LyX

I have the following problem: I want to import the outcome of solve(b^4-(2-d)*b^2-2*d*b+d+1 > 0, [b], parametric), which is a maple code, into Lyx. Even though I managed to export the solution of ...
5
votes
1answer
126 views

Not colored digits after characters in lstlisting code

I am writing a LaTeX document with Verilog code and I would like to have colored digits in these occasions: simple digits (for example # 30) bus (for example [3:0]) binary or hex representation ...
2
votes
1answer
133 views

Lyx code tag with highlighting for C

I just installed Lyx and when I try to insert the program I observe that there is no syntax highlighting. What is the best way to allow for syntax highlighting in LYX?
1
vote
0answers
41 views

Inserting a stand alone code file using lstlisting

I am in the process of writing a report on a project and need to include the final code used in an appendix. The final code while not yet complete, is lengthy enough that I would like to just use ...
3
votes
0answers
63 views

How to use same font-style with escapechar in lstlisting?

Original Question I want to highlight something inside a C++-comment in a code-listing. \documentclass[a4paper, 12pt]{article} \usepackage{color} \usepackage{listings} ...
0
votes
1answer
50 views

Replicate pseudocode

I was looking for some LaTeX code to replicate the result shown on the image below. This image is taken from the book "Temporal Verification of Reactive Systems - safety"
4
votes
1answer
127 views

Changing ( and ) to \left( and \right)

Are there any plans to have the LaTeX automatically read all ( and ) to automatically become \left( and \right)? If so, then when can we expect the update?
0
votes
0answers
28 views

Line breaks in source code [duplicate]

When composing an article in LaTeX, where is it appropriate to break lines in the code? An easy (and adequate) answer is, 'Wherever you like,' but is there a commonly accepted standard (e.g., after x ...
1
vote
1answer
40 views

How to except code blocks from csquotes smart quoting?

\LaTeX newbie here. I figured out that csquotes can be used to automate smart curly quotes, and have added this to my preamble: \usepackage{csquotes} \MakeOuterQuote{"} This has the effect of ...
3
votes
1answer
69 views

Necessary package for “codeexample”

What is the necessary package for \begin{codeexample}[] \end{codeexample} In latex? When we use this?
6
votes
1answer
121 views

Highlight code with squared brackets

I want to show some .ini file in my work. The ini file works with squared brackets. I try to use \lstdefinelanguage but I can't handle it. That is what I try before and in my understanding it should ...
2
votes
1answer
66 views

Tabular inside listings

I'm trying to get this with this style but I'm getting the error ! Misplaced \omit. \multispan ->\omit \@multispan Here is a MWE: \documentclass{article} ...
6
votes
2answers
277 views

Is it possible to insert C++ code into LaTeX?

I mean C++ doing some calculation not inserting the code as a text.
0
votes
1answer
83 views

Can I make IPython notebook from PythonTeX ?

Let's example like this : \begin{ipythonconsole} 1+1 \end{ipythonconsole} then I will get the result like this : In[1] : 1+1 Out[1] : 2
0
votes
0answers
17 views

Inserting code - Beamer [duplicate]

I used to use lstlistings to insert code in LaTeX... It doesn't seem to work with beamer class, though. So... Is there a cool environment where I can insert code (I'm using c++) and set formating, ...
7
votes
1answer
276 views

IPython Notebook cells with listings

I would like to include in my document some code examples that look like the IPython Notebook cells in this image: I have produced something that looks a bit like it with the code below: ...
3
votes
1answer
129 views

Greek Text (babel) and English Code Text (listings): Problem

I use the babel package in order to write in greek with font "kerkis". I want to add code in english ("courier new" font) to my latex document but I get some difficulties. Can anybody help me, ...
4
votes
1answer
60 views

Shorthand for \lstinline{ … }?

I'm finding that I need to use \lstinline{...} a lot. I rather like the way that SX does inline code. Just enclose in back-ticks. Is this functionality available in LaTeX, or is it possible for ...
0
votes
1answer
75 views

Detecting (another) sub-minipage inside an encapsulating minipage?

Is it possible to detect if a minipage is present in an encapsulating minipage? Let me expand on that: I have a float environment which, simplified, can be defined by ...
1
vote
1answer
66 views

How to install a package written by myself? [duplicate]

I have a question. How can I install a package written by myself with MikTeX? I first made a .txt file than I wrote my package (code) in there. Then I renamed the .txt file to .sty . What should I do ...
3
votes
2answers
128 views

including a C++ code in my latex document

I am trying to include a C++ code in my latex document. However, what I have tried is not working. Everything else works fine, but I am not seeing the C++ showing up as a C++ code. It is just written ...
1
vote
1answer
127 views

How do I highlight a block of source code in LaTeX?

I have many blocks of source code in my document (each of them is at least 40 lines). I would like to format parts of these code blocks, preferably with some annotations on the right. I was thinking ...