The tag has no wiki summary.

learn more… | top users | synonyms

4
votes
1answer
73 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 . ...
2
votes
0answers
39 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 ...
14
votes
2answers
3k views

\listings code style for HTML5 (CSS, HTML, JavaScript)

I would like to create a code style for HTML5 that can be used with the \listings package. An HTML5 document consists of three languages: CSS, HTML and JavaScript. That makes the whole thing a bit ...
6
votes
1answer
82 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
126 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
43 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 ...
0
votes
0answers
52 views

Writing up notes and tutorial

I am using article documentclass for writing up notes and tutorial. Is their any other class more suitable for writing the notes and tutorials? Moreover, I want to include MATLAB and R code in boxes ...
2
votes
1answer
72 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 ...
4
votes
1answer
69 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? ...
2
votes
0answers
48 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 ...
7
votes
3answers
179 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}{!} { ...
8
votes
3answers
576 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.
0
votes
1answer
69 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
45 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: ...
22
votes
1answer
8k views

How to properly code a TeX file, or at least avoid `badness 10000`

I'm coding a TeX file and although the .pdf is correctly rendered, I'm using "stone age" tools to code it. As some examples, I use \\ to leave a line space between two paragraphs, or \noindent in ...
1
vote
0answers
27 views

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

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 ...
4
votes
1answer
53 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 ...
55
votes
6answers
2k views

How bad for TeX is omitting braces {}, even if the result is the same?

Sometimes writing braces and omitting them produces the same result: \tilde{\psi} \mathrm{e}^{\mathrm{i} \pi} vs \tilde \psi \mathrm e^{\mathrm i \pi} Or (taken from Werner's comment below) ...
3
votes
1answer
56 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
53 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} ...
7
votes
2answers
5k views

Code Snippet IN Text

How do I show a code snippet directly in my text? I dont want to have an extra box for it like lstlisting or verbatim provide it. My example may should look like this: The class List.class is... ...
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} ...
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 ...
4
votes
2answers
217 views

Is there a package for doing this in LaTeX?

I'd like to do something like this What would be the code? does it use a package for doing the $$f\mapsto f\circ \pi$$ part?
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
148 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. ...
55
votes
3answers
3k views

Are there any coding style guidelines for LaTeX?

I have been using LaTeX for a long time now, but still all my document files look a bit messy. Now I want to get rid of this bad habit and get some order into my code. That is why I am wondering ...
5
votes
2answers
4k views

Is there a way to enable syntax highlighting coloring in Lyx for program listings?

I want to embed a small program listing and have used Insert -> Program Listing in LyX's menu for that. The settings dialog supports selecting a language (Java), but I can't actually see any ...
1
vote
0answers
71 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
0answers
59 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 ...
2
votes
1answer
278 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?
9
votes
5answers
680 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 ...
0
votes
0answers
83 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. ...
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
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
864 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
112 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 ...
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 ...
1
vote
0answers
336 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
747 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 ...
2
votes
1answer
114 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} ...
33
votes
3answers
4k views

LaTeX code sniffer and/or beautifier?

I'm looking for a LaTeX code sniffer and/or code beautifier, because I'm creating a CI server for my LaTeX books and I wanted a few things. :D
6
votes
3answers
243 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 ...
2
votes
0answers
102 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 ...
5
votes
1answer
112 views

“Listings” environment for GAP

I was searching the web for a possible environment where I can put my GAP (Groups, Algorithms, Programming) codes. The most promising I saw was the "listings" package. But to my disappointment, this ...
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 ...
1
vote
1answer
264 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 ...
10
votes
1answer
791 views

Code readability

I'm getting my head around LaTeX, and I find really awesome the fact that the documents are completely editable with a plain text editor, while getting a really neat and professional output. I'm ...
4
votes
0answers
177 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
947 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 ...