{sourcecode} is a collection of computer instructions, here for (La)TeX.

learn more… | top users | synonyms

7
votes
1answer
89 views

! I can't find file `['

I am writing my thesis by using LaTeX and the toptesi package. I am mostly writing on my laptop, but sometimes I need to switch to my other PC. I encounter some problems here when generating the pdf ...
1
vote
0answers
16 views

Get source code as it is from output [duplicate]

I am trying to display my XQuery code in a latex document as follows: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{listings} \title{code} \date{January 2016} \begin{document} ...
1
vote
0answers
58 views

How can I define a new language? [closed]

i need to insert code into my document which is written in ST (structured text) (PLL language). Couldn't find any existing solution in the web. How to add the language to the package to use it? ...
0
votes
0answers
27 views

Displaying source code listing with strikethrough/strikeout

I'm preparing for a presentation in which I would like to show some source code with bits struck out. Does anyone know a package that can do that? I've googled but can't find anything. Here's my MWE, ...
13
votes
5answers
2k views

List of books written in LaTeX with the source available

Is there a list of open source LaTeX books? I've only found these books but I want to know if there is a list with more diversity as this has only mathematical books. I want to find open source books ...
3
votes
1answer
107 views

Hanging indentation of source code within sentence a la Vim-LaTeX-Box

I've recently been playing with the LaTex-Box plugin for Vim and noticed the layout of the source code on their Github page: What interests me is the 2-space hanging indent within each sentence. ...
0
votes
1answer
25 views

Unable to include “large” code in lyx files

Following this question I was able to insert (Java) code into my lyx document. However, when I try to visualize (export it as a .pdf) the following error comes up: I can't work with sizes bigger than ...
1
vote
1answer
58 views

Why does source code in my header of report appear?

In my header is source code where nothing is supposed to be. Main document: \documentclass[a4paper,12pt]{report}\usepackage{lipsum} \usepackage{fancyhdr} ...
9
votes
2answers
315 views

When is leading/opening whitespace of a line in a tex file important?

According to https://en.wikibooks.org/wiki/LaTeX/Basics#Spaces ... opening space is generally ignored. First of all, I don't know what generally refers to. I came across this using chktex a ...
1
vote
0answers
28 views

What is the correct way to refer to the code that one enters in an editor?

I am a question about terminology. When I think about source code I usually think about the code that a program is compiled from. But I also often call the code in the .tex file source code. Is this ...
42
votes
2answers
4k views

Styleguide for LaTeX similar to the Google styleguides?

Even though I don't work at Google, the Google Styleguides have been very helpful for me in adopting consistent, readable style conventions for my code. Unfortunately, there is no Google Styleguide ...
3
votes
0answers
62 views

Diagrams of TeX Design

In order to understand TeX better, and in order to procrastinate on stuff that is almost certainly more important, I'm slowly working my way through a YouTube series of Knuth explaining TeX82 ...
2
votes
0answers
41 views

Post a question based on another tex file - Eg. Legrand Orange Book template [closed]

If you modified the Legrand Orange Book template to include other environments, and are getting errors based on the new environment, how do you post your code? Thanks.
1
vote
1answer
79 views

LaTeX graphical lines for domain results

As usual I have a problem with LaTeX code; this time is to show the results of domains interval for example when I have a rational function and I have to split domains into the Numerator one and the ...
2
votes
1answer
35 views

How to deal with large number of references in one \cite{}

I am writing a review type document and very often I have to cite 5+ papers in a single \cite{} command. I can't seem to find any documentation on how to best deal with this. The problem is ...
57
votes
11answers
4k views

What are the pros and cons of using hard wrapping, and why is it so common with LaTeX?

It seems that hard-wrapping - i.e. inserting a newline when the line reaches a certain threshold - is extremely common in the LaTeX source when writing technical papers, either by manually inserting ...
15
votes
2answers
1k views

Is there such a thing as a LaTeX code formatter

I was looking for this a while back for JavaScript, but I was wondering a general purpose one exists for all, or most languages. For example for LaTeX I would put the following in a text box ...
22
votes
2answers
2k views

Pretty printing of LaTeX code

In many MWE here on TeX.SE the LaTeX code is written without explanatory comments and as compact as possible. An Example: \documentclass[ngerman,fontsize=12pt,pagesize]{scrreprt} ...
21
votes
4answers
5k views

Why can't TeX Live's size be reduced?

I understand that the following question has been answered Why is the MacTeX distribution so large? Is there anything smaller for OS X? but my question differs from it. I just installed MacTeX and ...
3
votes
1answer
122 views

Packages used in this image?

Does somebody know which packages were used to create the following homework assignment? I would like to insert Java source code in exactly the same way in my .tex files
0
votes
0answers
40 views

How to fix comment indentation of code using the listings package?

My problem is that the code itself is indented correctly, but the comments (e.g. //comment) are not. In my source file, I aligned comments in one column by using tabs. In the pdf produced by LaTeX, ...
4
votes
2answers
488 views

Is there a way to make ChkTeX ignore TikZ code

ChkTeX does not like TikZ, and will report a bunch of errors. Is there a way to make ChkTex ignore TikZ code?
2
votes
3answers
73 views

How can I add 1 line of source code (source code snippet) in a LaTeX document?

The easiest way of explaining this is probably to provide an example of what I want to do: Consider the following section of a LaTeX document. Calls to the function // a blank line ...
0
votes
0answers
71 views

JavaScript ES6 Code highlighting

I'm using the latest minted to highlight my sourcecode. I've got a lot of code listings using ES5 and ES6 javascript features but minted is lacking a lot of them still. What can I do to get proper ...
0
votes
0answers
15 views

Including a particular function from a source file

I know I can use the listings package to include specific lines of a source file in my document, but is there any option or package that would allow me to specify a particular function to include ...
9
votes
1answer
100 views

Finding METAFONT sources of a specific character

I'm trying to find out the METAFONT source of percent (%) character, which is created by \% with TeX. I am using the Normal CMR10 font. I am doing this, because I want a slightly modified version of ...
1
vote
1answer
47 views

How to prevent line breaks in code listings?

I am adding a big Linux terminal output as a listing and would like to prevent these line breaks from happening: e.g. user@pc ~ $ top PID USER PR NI VIRT RES SHR S %CPU %MEM ...
2
votes
1answer
58 views

Using `inputminted` in lyx has no effect on document

I'm trying to import a complete code file into a lyx document using the minted package. But the resulting document has no code at all. Here is a minimal example. And there's nothing in the resulting ...
1
vote
1answer
73 views

Using minted for syntax highlighting with RTL language reverses code

I'm writing a LyX document in Hebrew and I want to inset some inline code snippet but the code is reversed when rendered. The minimal lyx example is here. And it look like this: LyX source: ...
2
votes
0answers
188 views

Python console code with minted

I am using minted to highlight source code in my document. I have defined \definecolor{codeyellow}{RGB}{255,251,204} \newminted{python}{linenos,breaklines,frame=lines,bgcolor=codeyellow} in the ...
3
votes
1answer
183 views

How to insert sourcecode?

For my internship, I have to print all the source of my iOS application to a LaTeX file. Now I'd like to do this in a structured way by having sections, subsections and subsubsections for each nested ...
6
votes
2answers
5k views

Is there a good definition for highlighting PHP code in listings?

Does someone have a good definition for highlighting PHP code with the listings package?
10
votes
2answers
229 views

Where can I find a manual for learning the fundamental background of LaTeX source?

I would like to know if there is some manual from which I can learn the bases of LaTeX programming language. I need something universal, not related to some specific package or class, that at the end ...
2
votes
0answers
25 views

Automatic reformatting / style checking of input files? [duplicate]

Coming from Python land, one of the best tools is autopep8 and alike which automatically tweak the layout and spacing of your programs to fit the PEP8 code style guide. My basic question is: are ...
2
votes
0answers
26 views

Indentation marker for listings

I'm currently writing a document that contains several code samples. I included them as lstlistings and played around with the colors and everything, so they loot quite nice now. My only problem is ...
1
vote
1answer
109 views

Python code block outside of margin

I want to include some Python code to my Latex document. I have read this Tex Stackexchange question and added the following code to get syntax highlights: \usepackage{color} ...
1
vote
0answers
38 views

Best practice for writing. Oneliner? Enter key? \\? \newline? [duplicate]

I just started using LaTeX to write my bachelor thesis and everything is already set up and working (took 2 weeks but it is finally done). I was just starting to write a chapter and am wondering what ...
0
votes
0answers
35 views

Is there an accepted best practice when it comes out to laying out code? [duplicate]

Many languages, such as python, have strict rules as to how best to lay out the code. I have looked around but I can't find anything that details this for Latex. For example when looking at creating ...
5
votes
1answer
65 views

How does the stripcommand in the pgfmanual file work?

I am trying to understand how commands are typeset for use in LaTeX documentation. To clarify, not using LaTeX to create documentation, rather to write documentation in LaTeX about using LaTeX (like ...
5
votes
1answer
168 views

question regarding tex design previously done by Yannis

i obtained a repository dump from github phd-master ( impressive work Yiannis has done i must acknowledge) i am in the process or rereading my draft of work for self publishing- and i have looked ...
1
vote
2answers
62 views

Box and title of the box containing code [duplicate]

As the attached picture describe, this is what I am trying to replicate. Now the text does not need to be the same, since I am going to write different content inside but I really like the way this ...
5
votes
1answer
592 views

How to stop verbatim from converting tabs to spaces?

I am using verbatim to put some sample code in my document: \begin{verbatim} [start] printf{"Start command received"}; [stop] printf{"Stop command received"}; \end{verbatim} I ...
2
votes
1answer
122 views

How can I add source code like the following image in the beamer frame?

I have tried the listings package, but the question is that I can not type math equation in it. (The line number on the left start from the first line, i.e. type val is also OK for me.)
3
votes
1answer
1k views

What is the best way to include R code in the Latex paragraph

I am a newbie in Latex. I have two simple questions regarding including R code in Latex. Q1: For a block of R code, I use 'listings' package, as follows. \documentclass[12pt]{report} ...
2
votes
1answer
95 views

Bold code in listings environment

I want to do a box like this but the bold text doesn't appear. Edited: \documentclass{article} \usepackage{listings,xcolor,etoolbox,lmodern} \definecolor{verbgray}{gray}{0.9} ...
4
votes
1answer
55 views

Put default text in listings environment

I want to make a gray box with some code inside but it should already appear a centered tilde followed by a dollar sign. Or how can I use a command inside the environment to obtain certain text like ...
4
votes
2answers
10k views

Edit LaTeX source in LyX

I recently installed LyX 2.0.1 (2011-08-31). I have the option to display the LaTeX source. I have tried to modify this source (in the LyX tab) in order to get some changes in the LyX file and the pdf ...
1
vote
1answer
187 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 ...
3
votes
0answers
109 views

Listing sourcecode - two columns, associations with colored background

I stumbeled over a way of formatting sourcecode in a book I am currently reading. It looks like this: So basically we have a following structure: There are two columns. Left column contains the ...
4
votes
1answer
118 views

LESS and SASS source code formatting

I need to add piece of source code in LESS and SASS. Piece of code is divided into two columns. First column is source code in Less and second column in Sass, something like on this page, but without ...