Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sourcecode]

{sourcecode} is for questions regarding the source code for (La)TeX documents, including syntax questions, style decisions, package sources, etc. For questions about printing code in LaTeX documents, use the {code} tag.

1
vote
2answers
44 views

How can we Define our own Simple Environment for Source Code?

Inside of our document we wish to define a new environment for blocks of source code \newenvironment{srcblock}% % Define the environment Later, we will use the environment: \begin{srcblock} % use ...
0
votes
1answer
50 views

What is the advantage of using a pseudocode package instead of simply putting code inside of a verbatim block? [closed]

What are the advantages of using a pseudocode package (like algorithm2e) above simply putting code inside of a verbatim block? Edit: In order to make the question less vague, I will say this: ...
2
votes
1answer
37 views

Hebrew within sourcecode

I need to include LaTeX source code, which contains Hebrew text, within an Hebrew document. I tried doing so within a verbatim environment, but Hebrew words appear in opposite order. Any solution ...
2
votes
1answer
31 views

Problem inserting C snippet

I am trying to insert an snippet like this But when I write \usepackage{listings} \lstset{language=C} \begin{document} \begin{lstlisting} typedef double real_t; // Esto casi seguro necesita ser tipo ...
3
votes
2answers
79 views

Add keywords at the bottom of a document

I want to use \documentclass[12pt,a4paper]{article} in the place of \documentclass[12pt,reqno]{amsart}. However I want to add the following in the bottom of the first page This is my codes \...
0
votes
2answers
26 views

Reducing space in the Table of Contents

I'm using the following codes \documentclass[12pt,a4paper]{report} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Useful Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %---------------------math--------...
0
votes
1answer
43 views

remove all insignificant whitespace from tex source

Is there an existing tool for removing all insignificant whitespace from the source of a tex document? I'd like to run this before calling latexindent to see if I can have an autoformatter tool that ...
1
vote
1answer
28 views

The bottom of the first page of a report

I want to obtain the bottom of my first page of my report like the following Could you please help me with the necessary codes? My attempt: \documentclass[12pt,a4paper]{article} \usepackage{...
4
votes
1answer
228 views

How to use true/false inside definitions?

Suppose you want to define page style depending on a boolean value. I think both constructions below have equivalent output (or not?), but which is better/more indicated/professional/elegant? \if@...
2
votes
1answer
39 views

Documentation of loop over item

In this answer there is a loop construct used called loop over item. I am looking for a documentation of this and for a reference in which file it is defined. \ifdate{workday} { \tikzset{every ...
7
votes
0answers
121 views

LaTeX Uglifier / obfuscator

For JavaScript you have e.g. js uglifier, which obfuscates the javascript so that it is infeasible for humans to read the javascript code. Also, judging by @DavidCarlisle's xii.tex (see below), ...
2
votes
1answer
70 views

How do I get separate source code functions in one line?

It it difficult to create a question for this. I want to tex source code like here. Is this with listings? Which package do they use? How do I get the separate procedures in one line? And how do I get ...
6
votes
1answer
496 views

How to embedded source code on-demand into PDF?

I wondered if its possible to embed source code of some software you are writing about into the PDF but not displayed by default. E.g. you have a long script I would be nice if the user/reader could ...
0
votes
1answer
86 views

How to import Java source code from multiple folders to LaTeX

I want to add all my Java source code to an appendix. But I have 20 projects. Is there a possibility to just tell LaTeX where the folder with the different projects are, and LaTeX collects all the ...
3
votes
1answer
226 views

LaTeX convention how to indent source? [closed]

I am new at LaTeX and I am asking myself at the moment if there is a convention how to indent the source code. For example: \begin{itemize} \item erstes Stichwort \item zweites Stichwort \end{...
1
vote
0answers
100 views

Minted vs matlab-prettifier for thesis [closed]

I am writing my PhD thesis now for which I need to list snippets of source-code within the main text and full listings in the appendix. I did my coding entirely in MATLAB using advanced constructs ...
0
votes
0answers
33 views

Add source code from multiple files into thesis [duplicate]

I am currently writing my thesis in Latex. I am supposed to include the source code in the appendix. I know that I can include code as listings into my text. Since my code is spread along multiple ...
1
vote
1answer
85 views

Lyx source code from tex extension to lyx

A friend sent me a lyx file to edit it. I had no idea how lyx works so I assumed it was similar to the usual latex. Since I hadn't lyx installed, I opened with texmaker as a .tex file and edited. I ...
6
votes
1answer
67 views

How to emphasize in a listing and keep source columns aligned?

I use moredelim with * to highlight some text in my lstlisting. \documentclass{article} \usepackage{listings} \usepackage[LY1]{fontenc} \renewcommand{\rmdefault}{ptm} \renewcommand{\ttdefault}{...
1
vote
1answer
58 views

Malformed dots when using listings

How is it possible to compile such page? \begin{lstlisting} ⡂⡀⣀⢀⣄⡀⣰⡉⡀⠀⡀⡀⣀⠀⢀⣀⢀⣄⡀⡂⢀⣀⡀⢀⢀⡀⠀⡰⣀⠀⣀⠀⡂⡀⣀⢀⣄⡰⡀⢠⠂ ⡇⡏⠀⡇⡇⠀⢸⠀⡇⢀⡇⡏⠀⡇⣏⠀⠀⡇⠀⡇⣏⠀⣹⢸⠁⢸⠀⡇⢈⠷⡁⠀⡇⡏⠀⡇⡇⠀⡇⢼⠀ ⠁⠁⠀⠁⠈⠁⠈⠀⠈⠁⠁⠁⠀⠁⠈⠉⠀⠈⠁⠁⠈⠉⠁⠈⠀⠈⠀⠱⠉⠀⠉⠀⠁⠁⠀⠁⠈⠱⠁⠘⠄ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀...
0
votes
0answers
486 views

Template For Software Project Design Document

I've searched this exchange and wasn't able to quite find what I'm looking for. First, I'm fairly new to Latex and have been tasked with creating a Technical Design Document for a project I've been ...
0
votes
1answer
55 views

go to source is not working with dvi-ps-pdf-chain in texstudio 2.10.8

I am using eps figures and and I want to put them into my latex file. everything is working with choosing dvi-ps-pdf-chain except "go to source". when I use this "go to source" is disappeared. It is ...
1
vote
1answer
154 views

Code validation in minted package? How to disable it?

I'm using minted for inserting syntax highlighted HTML code in my document. But it isn't simple HTML (valid HTML I mean) and has some special characters and definitions (if you're interested, it's ...
6
votes
2answers
139 views

Can one customize lstlisting environment?

I want to add some Python source code to my LaTeX document, but I want to apply some customization. Currently, I have something like this: \documentclass{article} \usepackage[utf8]{inputenc} \...
-1
votes
1answer
59 views

Writing code for image [closed]

Can someone help me to write code for the following figure. I want to insert it in a presentation and am not well versed with graphics?
3
votes
0answers
403 views

Formatting bash with listings

I writing a documentation in LaTeX about Linux Bash resp. Shell script. And I'm having some problems: How can I start a formatting at the beginning of a line? How can I format between two signs, but ...
3
votes
1answer
144 views

LaTeX(2e) Programming vs. expl3 (which to learn)

Recently, I've decided it would be a useful and interesting skill to be able to program LaTeX classes, macros etc, and so had a look around about what resources existed (this question was very helpful)...
0
votes
2answers
58 views

How to have one code to be typeset both as final and as source code [duplicate]

I'm very limited in writing Latex code and I could not find how to solve my problem searching in the forum ou googling around. My problem: I have to write a document with many algorithms and show ...
3
votes
1answer
404 views

Using listings package with beamer/block environments for displaying source code

I use beamer with semiverbatim environment to show source code. \documentclass{beamer} \setbeamercolor{background canvas}{bg=yellow} \useinnertheme[shadow]{rounded} \setbeamercolor{block title ...
0
votes
0answers
61 views

Updating theorem number in tex file

I honestly do not know how to search for this feature. Recently, I had an experience with skylatex for proofreading. One of the features I really enjoyed was that once I compiled my source file, the ...
1
vote
1answer
202 views

How do I find the meaning of latex documentclass options?

I saw someone using the [final] option for the beamer documentclass and wanted to see what it did. So I searched the package documentation here on CTAN and also found the directory on my computer that ...
2
votes
1answer
108 views

How to achieve this two column style?

I’d like to add some code examples in two column form. The left is a description and the right is the REPL input code and output. Here’s an example of what I’d like to achieve: Are there well known ...
1
vote
1answer
44 views

Why ~ is not shown in place in R source listings? [duplicate]

My sample code is- \documentclass{article} \usepackage{listings} \usepackage{xcolor} \begin{document} \lstinputlisting[numbers=left,backgroundcolor=\color{lightgray},language=R]{code.R} \end{document}...
1
vote
1answer
62 views

Scantokens and Newlines

I'm having problems with the usage of scantokens. I'm trying to convert a list that I read in while under the effects of \obeylines. For some reason, any time I use scantokens on my list, it stops ...
2
votes
1answer
321 views

Reading LuaTeX source

TL;DR: I want to read the source code of LuaTeX. How and where? I want to know exactly how the Knuth-Plass algorithm for line breaking is implemented in LuaTeX. Not an explanation, I want the source. ...
0
votes
1answer
851 views

How to paste source code into LaTeX with correct indentation

I am trying to use \begin{lstlisting} ... \end{lstlisting} to include some Python source code in LaTeX. When I paste the following code block: def plot_c(Yhat, Y, X): plt.figure() plt....
9
votes
1answer
211 views

Is there a newmarks command?

Is there a way to allocate the e-tex marks with names, similar to things like \newtoks? It shouldn't be too hard to implement, I just want to know if it exists already. To be clear: e-tex makes ...
4
votes
1answer
133 views

Where one can find an old version of `table` environment

This question is a result of an answer to Table captions do not appear on top in IEEETran class As far as I remember, a long time ago the caption for a table was always in a proper position. It was ...
0
votes
0answers
50 views

Bake '\today' into source file (or custom aux-file)

This is supposed to be a part of: Calendar instead of table of contents. Situation As mentioned I want to create a calendar-ish table of contents. The link to the heading (of eg. a chapter) should ...
0
votes
0answers
40 views

Check for equality of boxes

Is there any way to check for what the contents of a box are? I see that there's a way to check if it's void, and what type of box it is, but can you check what's in it? I'm working on a reflowing ...
5
votes
1answer
101 views

How can I include the Spanish characters in source code?

Hi i need help for fix this code in the part \begin{lstlisting}[style=Java] i have 2 errors can read the source code from another file and add a main .tex file? PD: i am new in LaTeX - PD 2: my ...
3
votes
1answer
74 views

Why is reinsertion in multicol different than usual?

I've recently been having an issue with multicol and dblfnote. The solution to the issue was to change the definition in multicol of \reinsert@footnote from \ifvoid\footins\else\insert\footins{}\fi ...
2
votes
1answer
75 views

How to trace all changes to a box

I'm currently knee-deep in debugging a mysterious bug in my daily usage of TeX. I have a fairly substantial list of packages that I use all at the same time, and I can't seem to track down the cause ...
3
votes
2answers
294 views

lstlisting - giving source - smaller font, alongside caption, preferably above caption

I would like to separate description of listing (\caption{}) from source of listing. What I search for is like \footnotesize in presenting pictures (\begin{figure}). I was searching for this at latex ...
4
votes
1answer
115 views

Is it safe to define \@nil?

I've been having a random issue recently with dblfnote, where TeX tells me that it's trying to execute \@nil, which is undefined. Now, I did my research and saw from source2e that \@nil is generally ...
3
votes
1answer
71 views

Multiple Matrix Formatting

I'm wondering if there's a more cleaner/nicer way to write this equation \begin{document} \begin{enumerate}[a.)] \item If $u_i, v_i \in \R $ for $1 \leq i \leq 2 $, then \begin{equation*} ...
0
votes
1answer
97 views

What is the meaning of the control-sequence \@undefined in the pgf/tikz source-code?

The control-sequence \@undefined appears several times in the pgf/tikz source-code. For instance, in the file <pgf/tikz install dir>/utilities/pgfkeys.code.tex it appears twice: \expandafter\...
0
votes
1answer
75 views

`Undefined control sequence` error when trying to write the value of a \csname…\endcsname control-sequence to the log file

In reading the source-code of pgf's object-oriented programming module in <pgf/tikz install dir>/modules/pgfmoduleoo.code.tex, I wrote the following plain TeX manuscript to experiment with the ...
3
votes
1answer
204 views

The meaning of two seemingly undefined control-sequences in the PGF source code

The following macro is defined in <pgf/tikz installation dir>/utilities/pgfutil-common.tex. % Usage: % \pgfutil@in@{one}{three two one} % \ifpgfutil@in@ % -> will be true! % \else % \fi % %...
2
votes
1answer
127 views

Is pgfplot implemented using the TikZ data visualization library?

Is the pgfplot package implemented in terms of the TikZ data visualization library, or are they independent of each other?