The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
1answer
36 views

Turning off/on numbering when using mcode

I have an appendix with a full Matlab script, quoted verbatim, numbered and coloured as I want. However, I want to quote about 10 lines of it as a figure in the body of my report, and since I will ...
0
votes
1answer
47 views

How to force wrap MATLAB code

I'm including a MATLAB script as an appendix in a report I'm writing, I'm using mcode to import it, but some of the lines are longer than the width of my paper. In my master document I have: ...
0
votes
1answer
46 views

How can I include the R source code in the appendix?

I really have no idea how to include the R code into latex, so I only can provide my R code. I would like to put it in the appendix. I am really looking forward to your help. Thx! The codes will show ...
1
vote
0answers
42 views

Dummy code box in LaTeX

I am not used to work in TeX and I need to write a dummy code box like in this style. I am not entirely sure how to replicate this style. I found some code boxes, but not in this structure that I want ...
5
votes
1answer
46 views

Apostrophe breaks comments in lstlisting

I defined a command to simplify the writing of code listings of (pseudo-) C code: \lstdefinestyle{c}{ language=C, basicstyle=\small\sffamily, numbers=left, numberstyle=\tiny, frame=L, ...
1
vote
0answers
44 views

How can insert a full-width listing in a two-column document? [duplicate]

I'm new to LaTeX; I'm using IEEE format. How can I effectively add Java code snippets in one full-width column?
5
votes
1answer
59 views

Correctly highlighting custom html tags in listings

Problem statement I have several code listings containing HTML markup in my latex files. These listings contain multiple custom html tags (created in combination with corresponding AngularJS ...
2
votes
1answer
63 views

How to only have similar font in latex to that of a Mathematica codes

After I used the answer posted to this question of mine: How to show similar display of codes of different programming languages in LaTeX, it seems that the package and styles I use have problems with ...
2
votes
1answer
36 views

How to page break a code print in a latex document into more pages instead of one

After this question How to show similar display of codes of different programming languages in LaTeX which prints a code in a standalone pdf document (for instance 1000 lines of code in only one pdf ...
4
votes
2answers
130 views

Saving language preferences for inputing source code

Using the listings package, I am trying to input a Java source file into my document using a specified, user-defined style. This works just fine if I have the specified style definition in the same ...
11
votes
1answer
493 views

How to show similar display of codes of different programming languages in LaTeX

I am very new to LaTeX and I am writing my thesis. In a chapter, I want to show my codes, which are in Mathematica. I use the listings package as follows: \documentclass{article} ...
4
votes
1answer
81 views

Command \color already defined

I have the following code in my latex command . \newcommand{\color}[1]{\lceil (#1+2)^2/2\rceil} After that I have inserted the following command for insertion of code in LATEX documents . ...
3
votes
0answers
44 views

Minted inside tabular

I know this question has been asked before, but it didn't quite solve my issue. (How to embed a minted environment inside a tabular environment?) The described workaround (bringing \end{minted} to a ...
6
votes
1answer
97 views

Macro, new command or new environment for code?

I am using the listings package to typeset code. I have defined a custom style using \lstdefinestyle{verbo} and then typeset code in a lstlisting environment as in the following MWE. ...
2
votes
0answers
147 views

pgf-Tikz code generator for Latex

LatexDraw is a PSTricks code generator for Latex. LatexDraw generates PSTricks codes of any fugure are drawn. Are there any such tools that will generate pgf-tikz code of any figure for latex? If ...
1
vote
0answers
44 views

Simulating a figure-environment

In this question of mine, I asked how to distribute two pictures with some text between evenly (across the horizontal) and got a really good answer. Here's the code of it, for those who don't want to ...
2
votes
1answer
100 views

How to achieve short journal names in this bibliography style using Biblatex package?

I use Zotero to get references from the web, and then export them into LaTeX using biblatex format using this workflow. I am fine with the style of bibliography and its output as shown below , but I ...
2
votes
0answers
55 views

Different colours for each argument and value in listings

This recent question (Print blue brackets in one language and black in another) made me come up with (up to) two more questions regarding the listings package: Is there an option similar to opstyle ...
4
votes
1answer
72 views

Print blue brackets in one language and black in another

In addition to that question i wonder if it is possible to have that settings for one language and default settings for another ? How to highlight operators and brackets in a C listing? ...
7
votes
3answers
187 views

How to construct the following table with title in LaTeX?

I would like to construct a table look like the picture below: The code below represents my best attempt so far (the words in the table don't really mean anything): \resizebox{9cm}{!} { ...
0
votes
1answer
75 views

Latex Listing Source shift right side?

I am using Latex listings package to add the source code in my document, but the problem is on the left side some character is missing as showing in the picture. \usepackage{listings} Source ...
1
vote
1answer
52 views

Code not wrapping in listings even though breaklines=true [closed]

I read that enabling breaklines in listings will make the included code wrap, but it does not in my case. Maybe something is interfering with this function? Full code is shown below: ...
1
vote
0answers
31 views

How to format a large text containing special Characters and breaklines? [duplicate]

I have this rather long text which is the output of a several console inputs. I'd like to have the text as it is as of right now. Here a link to the raw text since I didn't want to include it in this ...
5
votes
1answer
61 views

How to exclude code from spell-checking in LyX?

I'm writing a technical document in LyX (version 2.0.5.1 for Windows) and I'm using Hunspell for spell checking. Throughout the text, there are code snippets which I've formatted with the "Code" text ...
3
votes
1answer
63 views

Color of comments affects frame color in listings [duplicate]

I use listings package with single frame around it, when i place long comments in my code color of comments affects frame color. Frame around lines with comments are green. I want frame to be black, ...
3
votes
2answers
55 views

“Extra” unwanted first page

I've got a problem that creates an extra first page, that contains one sentence... I can't find the problem to this. \documentclass[a4paper,onecolumn]{report} \setlength{\parskip}{4pt} ...
3
votes
1answer
38 views

How can I put an environment within a subsection?

I have this code, but the environment is put at the top of the page above the sections. \documentclass[a4paper,11pt]{article} \usepackage[utf8]{inputenc} \usepackage[italian]{babel} ...
8
votes
3answers
767 views

Writing source code in LaTeX as text

Is there a package that allows source code in LaTeX as text? I rather not use listings package because the code takes too much space. Copy/paste is tedious because the spaces are not preserved.
2
votes
0answers
37 views

Page could not be rendered error while viewing YAP using listings package [closed]

I cannot view the DVI output in YAP, as it shows the below error (The page could not be rendered) if I use the listings package. Could any one suggest me how to solve this error?
1
vote
0answers
167 views

Get TeX to work with jsPdf [closed]

jsPdf is a Javascript library that creates pdf documents on the fly. This is very useful to me as I have a familiarity with Javascript and I want to be able to do this operation server-side. ...
2
votes
0answers
66 views

Latex makes some characters big [closed]

Tried out the package for color coding Python code and when I did, the fonts in the entire document suddenly started acting weird. s, a, o and some other letters are typeset larger than others and the ...
1
vote
0answers
77 views

Separate LaTeX 3 code from 'normal' \newcommand [closed]

Consider the example from here: \documentclass{article} \usepackage{amsmath} \usepackage{siunitx} \ExplSyntaxOn \newcommand*\calculation[1]{% \dfrac{\SI{#1}{\g}}{\SI{\total}{\g}} \cdot ...
2
votes
1answer
342 views

Rendering VHDL in latex

I have a VHDL code which I want to insert into my latex document. I need a package that takes care of syntax highlighting, indentation etc. Is there a package which serves this purpose?
0
votes
0answers
88 views

Indented Code Blocks Have no Background Color When Generating PDF

As the title says, when I run: pandoc -o book.pdf book.md The code blocks show up in monotype font but with no background color. I've also tried all styles using --highlight-style with no success. ...
1
vote
0answers
30 views

How to organise code [duplicate]

At the moment I write macros without breaking them up, like so: \NewDocumentCommand{\HC}{ o }{\IfNoValueTF{#1} {\emph{HC}\xspace}{\emph{HC}, p.#1\xspace}} This obviously gets pretty hard to follow ...
24
votes
2answers
872 views

How to understand and write LaTeX code?

LaTeX is like a language. In order to write LaTeX code I have to understand the "word" and the "sentences structure". I have searched on wiki, some LaTeX books, but they just give the LaTeX command, ...
2
votes
0answers
124 views

Show vertical line for indentation of LaTeX code listing

Is it possible to enable a continuous vertical line on code to show indentation? I am trying to use the following code from a stackoverflow question. Originally, the documentation suggests using ...
6
votes
1answer
82 views

What is faster? To \RequirePackage{foo} or to check if the user has actually request it and \Require it if so?

I'm asking this because the package lineno has a thing that leaves a lot of commands in the .aux file (see here)... and I'm not sure if I should \newcommand these to empty or if I should just load the ...
1
vote
0answers
361 views

Change font style for \texttt [closed]

I am afraid if this is a repeat question. I have checked the following links for any hints: Change font size of \texttt globally? Using same font for \texttt and \Verb The question is simply. I ...
9
votes
1answer
841 views

How to typeset LaTeX code inside a Table environment?

I wanted to typeset LaTeX code directly into my document, but without it doing something, i.e., I just want to show my code in the output. Now, I know there is the verbatim environment for code, as ...
3
votes
2answers
89 views

How to write sub lemmas

I want to code like that, Lemma 1. I will marry if, Case (i) I found a soul mate Case (ii) never married How would I code this in LaTeX, I have used \newtheorem{lemma}{Lemma} but I dont know how ...
2
votes
1answer
115 views

How to make color from the table Ruffini - Horner Algoritms? [closed]

I Have problem about to make the table ruffini- horner algoritms,and i take a code from this question command for table Ruffini-Horners Algorithm , \documentclass{article} \usepackage{xparse} ...
9
votes
5answers
715 views

How to write a code to find the Pythagorean Triples

I want to write a code to make a table contains Pythagorean Triples (see picture) automatically. That is mean from the formulas $a^2 + b^2 = c^2$ , we can get the Pythagorean Triples I used ...
28
votes
5answers
2k views

How to produce a list of prime numbers in LaTeX

I would like to write a LaTeX script that produces all the prime numbers between the numbers n and m, where n < m. How can I do this? I feel it shoud not be that hard, but I cannot seem to program ...
2
votes
0answers
106 views

Deciding whether to end a line with a character or not in lstlisting [closed]

I need to write a document where there are written inputs and outputs of unix command line interface software (through bash). For example I need to show something like: $ git log --pretty=format:"%h ...
1
vote
1answer
302 views

Pandoc caption for code blocks [closed]

Consider the following code block: ~~~~{.Python .numberLines caption="test"} def myfunction(var): """ Oh how awesome this is. """ pass ~~~~ The code gets formatted correctly in the Pdf, but the ...
2
votes
0answers
103 views

Eclipse with texclipse code completion

I am using Eclipse with texclipse. Code completions are not showing up for some of the commands. For example: \mbox{}, \mathcal{} and for some others that i cannot recall at the moment. (If this ...
6
votes
3answers
251 views

How to keep tables readable in code

What is the best practice for creating and updating tables in Latex? I am using Texmaker but I find it hard to update a table like adding entries or adding a column. I have to count entries which is ...
4
votes
0answers
189 views

Collapse/expand in document [closed]

Perhaps this is a dumb question. I write a small pdf-book on coding and use there many examples using listings package. But the amount of code expands text too much, for every 5 lines of text there ...
11
votes
1answer
1k views

listings package: no numbering in case the code has only one line

I have a custom style in lstlisting with numbers on the left and the number step is set every line. I would want to know how the listings could appear without number in case the listing has only one ...