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

learn more… | top users | synonyms

6
votes
1answer
135 views

Is there a tool for cleaning BibTeX source from LaTeX style escapes?

I have a BibTeX file which uses the old style LaTeX escapes, for example author = {Fjeld, Morten and Sch\"{a}r, Sissel Guttormsen} I want to read the file with a Scala script using jbibtex and ...
24
votes
2answers
991 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, ...
6
votes
2answers
1k views

How to put source code in a LaTeX table?

I am comparing source in a paper and I would like to put them in a table, so the differences are easily spotted. I used the following LaTeX code: \begin{tabular}{ | l | l | l |} Option 1 & ...
4
votes
1answer
128 views

TeX-aware source line wrapping

For various reasons, I prefer to have short physical lines in my latex documents, so that the various editors I switch among don't need to soft-wrap the display. But many GUI editors have terrible ...
22
votes
6answers
1k views

Why doesn't LaTeX interpret `(` as `\left(` and `)` as `\right)`?

First of all I love LaTeX/MathJax; I use it a lot, but there are couple of things I hate about it. Sometimes the code becomes so messy that I almost can't read it without looking at the output, while ...
1
vote
1answer
1k views

TeXstudio not correctly working on Mac OS X

Yesterday I installed TeXstudio on my Ubuntu system. I realized it has nice functions like "jump to PDF" (goes to PDF and highlights the marked text) and "go to source code" (goes to the source code ...
6
votes
1answer
450 views

How can I get proper Matlab syntax when typesetting Matlab source code using the algorithm package?

I'm currently using the algorithm package for typesetting Matlab source code in my document. However, the way keywords are typeset doesn't match the Matlab syntax. For instance, \EndFor is typeset as ...
7
votes
1answer
134 views

Could significant speedups be gained from package code minification?

Wikipedia: Minification is (also minimisation or minimization), in computer programming languages and especially JavaScript, is the process of removing all unnecessary characters from source code ...
6
votes
1answer
275 views

Where to find LaTeX commands source code?

I would like to know where can I find the definition of an original command. That is, let's say I want to redefine the command \ref so when I type it, instead of showing just the number of the label ...
3
votes
0answers
115 views

Where can I share useful but unpolished code / hacks? [closed]

During the course of writing my thesis I've come up with loads of useful macros and hacks and implemented them for my own use. For a few of them I've actually written and published packages. But ...
2
votes
1answer
384 views

Adding caption and counter to source code environment

I have a source code listing with minted environment. How can I make a counter/caption to be shown as follows. I also need to make \tableofsourcecode to enlist all the source code references. The ...
2
votes
1answer
189 views

Handle % character in verbatim inside a grey box

I found this snippet on the internet which is used to produce a text area inside a greybox. \newcommand\greybox[1]{% \vskip\baselineskip% \par\noindent\colorbox{lightgray}{% ...
6
votes
2answers
181 views

Should I use a space or a new line after a period?

After a period in a .tex file, within a paragraph, should I use a space or a new line? I.e. like this: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec rhoncus vestibulum metus ut ...
0
votes
0answers
50 views

Math-mode aware search/replace utility? [duplicate]

As I gradually update the source code of my LaTeX documents to conform to new conventions, I find myself in need of a search/replace utility that is (or can be made) aware of LaTeX math mode. Often I ...
6
votes
1answer
435 views

Including LaTeX documentation as comments in source code

I am working on a large C# project (hundreds of source files). I am trying to add documentation on various user inputs and options. For maintainability I would ideally like to be able to write the ...
10
votes
2answers
206 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 ...
17
votes
2answers
3k 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 ...
11
votes
1answer
8k views

lstlisting line wrapping

How is it possible to let lstlisting wrap lines? I've troubles with following block: \begin{lstlisting}[language=java] public class MeasureStationControllerV0Test { MeasureStationControllerV0 ...
4
votes
2answers
1k views

Beautifully format text of an external document

I have some formatted long text files looking like this: f=50 k_max=420 Iteration Func-count min f(x) Procedure 0 1 7.07212e-09 1 2 ...
2
votes
1answer
532 views

Removing keywords and subject descriptors from a ACM template

I'm trying to customize a ACM template, the Large Format Single Column one [1] and really the main thing I want to get rid of is the subject descriptors and keywords part. I realize how important they ...
6
votes
1answer
438 views

Is there an alternative to LaTeX which isn't whitespace sensitive?

I have been using LaTeX for about a year now, and I quite like it. However, I like to space out my source code. In most languages, this doesn't cause an issue, as extra newlines don't affect meaning. ...
3
votes
2answers
306 views

Overbrace in lstlisting of Scala code

I want to add an overbrace to some text in a Scala code listing (using lstlisting). \begin{lstlisting} object TypeClass extends FooParMain { def newApp(args: Array[String]) = new FooParApp { ...
3
votes
0answers
335 views

Regular expressions in listings [closed]

I'm looking for a possibility to use regular expression in listings. I'd like to highlight each N thats followed by 4 decimal numbers for example N1234. How can I achieve that? Here is an example: ...
1
vote
0answers
92 views

spacing before scope resolution operator [closed]

I'm new to LaTeX and I have encountered a problem with the listings package, I have a space before the :: operator of C++ . after reading lstlisting with c++: spaces around scope resolution operator ...
2
votes
1answer
335 views

label for package: fancyvrb

I have a latex code for a computer program code like as specified in here. I want to write a label to this code. I searched for it but was unable to find how to add label for the source code. Any help ...
1
vote
0answers
390 views

Auto-indentation of LaTeX Source code in TeXShop [duplicate]

Sometimes, I find it a bit hard to manually indent my code so that all the \begin{...}'s and \end{...}'s align vertically in my .tex source code. In some code development environments, I know that ...
1
vote
1answer
181 views

Displaying (source)Code in research article [duplicate]

I have this urgent need to display two pieces of code side by side for comparison in my article. Displaying a code, I've couple of requirement Should indent properly Output should be syntax ...
1
vote
1answer
380 views

Word count excluding certain environments

I would like a way to get a word count while ignoring certain environments. The reason for this is that I have quite a bit of pseudocode enclosed within multiple verbatim blocks. Ideally, a solution ...
4
votes
1answer
192 views

Embed distributed LaTeX file/code to the PDF?

I have read of the possibility to embed the LaTeX source in a generated PDF, see the question here. Do you know of a way to do this with distributed TeX file, i.e. for a TeX file which is stored in ...
5
votes
1answer
559 views

Creating a table around a java script code highlighted using minted

I would like to create a block around javascript code in latex. I use minted package for format highlighting. Here is my example code: \documentclass[]{article} \usepackage{minted} %opening ...
9
votes
2answers
644 views

What are good packages / techniques for writing more readable LaTeX *code*?

A while ago I stumbled upon the semantic package --- its 'math ligatures' feature in particular --- and the whole way in which I write math-code in LaTeX changed. Instead of \[ \sem{\sigma}_s^x ...
30
votes
2answers
2k views

What are coding conventions in LaTeX?

What do I mean by Convention? First of all, allow me to clear myself about the word 'conventions. As most of you already know, coding conventions are a set of guidelines for a specific programming ...
0
votes
0answers
228 views

Usage of curly braces in math mode for macros [duplicate]

Possible Duplicate: Why do people use unnecessary braces? How bad for TeX is omitting braces {}, even if the result is the same? I wanted to know what is the preffered way of writing ...
4
votes
1answer
493 views

wrapping inline long lines and adding background color

Objective I'm trying to achieve the following output. Here's the code I used to produce it. I had to hack it \begin{document} \begin{description} \item In ...
7
votes
1answer
1k views

Enforce a line-break inside \lstinline

I use \lstinline{foo} from the listings package to set pieces of code in regular text. To get automatic line-breaks I use the following options: \lstset{ breaklines=true, breakatwhitespace=true, ...
6
votes
2answers
187 views

How to make a new line in the source file but not the output

I want to adhere to the traditional '80 character' line length limit in my .tex source file. How do I do a new line in the source but not in the document output?
7
votes
1answer
881 views

How to cite sourcecode from an svn repository

As part of my thesis I read some sourcecode. Unfortunately this sourcecode is only available as an svn repository. How do I write a reference to it? The shortest way I found of accessing it is: svn ...
7
votes
2answers
2k views

Folding entire section in AUCTeX?

I'm new to AUCTeX and I wonder: is it possible to fold entire sections or subsections of a LaTeX document for a better overview, so that they are only represented by their headline (kind of a tree ...
6
votes
2answers
348 views

C++ operators ^=, <<=, >>= misinterpreted

I write a list of C/C++ operators of the following form : \texttt{operator+=}, \texttt{operator-=}, \texttt{operator*=}... The problem is that \texttt{operator\^=}, \texttt{operator>>=}, ...
2
votes
1answer
3k views

How to get Matlab code into a LaTeX document?

I'm trying to put in my thesis matlab code but the results are not very good. I would get something like that but I don't know what packages using and how to create this result:
2
votes
0answers
130 views

The meaning of the percent sign in LaTeX coding [duplicate]

Possible Duplicate: What is the use of percent signs (%) at the end of lines? I know that % is commonly used to uncomment parts of the code, but recently I read that there is another use ...
6
votes
2answers
418 views

Comparing two versions of programming code with LaTeX

I'd like to compare two versions of program with vertical line between them. How can I do this with LaTeX?
8
votes
1answer
5k views

Insert code or text file in latex as is?

Question : How can I insert a txt file ( a source code) as such in latex without any change in indentation, tabs, formatting etc? Scenario : Consider I have a text file as below ( It is a part of a ...
9
votes
2answers
9k views

What's the best way to typeset C++ codes in latex?

I'm participating in a programming contest and we are allowed to prepare a team reference document which must not exceed 25 pages. Typically we will prepare many code templates and this year I'm ...
2
votes
1answer
234 views

Code for reading Metafont definitions

I need some C code to generate Bezier curves from Metafont source code. Ideally, I'd like to have a C/C++ function with the following specifications: Input: an array of text strings (the lines in the ...
3
votes
3answers
698 views

Recommendation for homework use [closed]

I'm re-discovering LaTeX after an absence of 15-17 years. Sadly all my previous skills are gone so I'm starting from scratch. I am taking two grad courses for which I have to submit assignments every ...
2
votes
1answer
162 views

Recover TeX source from automatically generated LaTeX files

Maybe the question can not be exactly understood from the title. So, to automate things a bit, instead of rewriting everything when adding different pictures and tables, code was made to add ...
0
votes
0answers
58 views

How to format a block of source code? [duplicate]

Possible Duplicate: Package to indent and syntax highlight C++ code I want to format a block of C source code using TeX, how can I accomplish this work? for example: int main() { ...
0
votes
1answer
186 views

Question about ArsClassica codes

I would to know for what is used the code below (Last lines code) in arsclassica.sty. Also I would to know why in arsclassica-settings there are some repetitions of \lstset is not the same thing put ...
7
votes
3answers
280 views

Expanding a minted command inside a macro

I am currently trying to speed up the compile time of a document that uses minted. I would like to be able to have certain language features (and style) appear the same in both a minted environment ...