Skip to main content

Questions tagged [programming]

{programming} is about how (La)TeX can be used as a programming language.

2 votes
2 answers
130 views

Build a new command "newsymbol" with NewDocumentCommand

I want to create a new command \newsymbol, which functions like \newcommand, but with the difference that math is ensured. I also have another reason, why I want to define this new command, namely so ...
Make42's user avatar
  • 1,812
4 votes
1 answer
103 views

Why \IfPackageAtLeastTF{⟨package⟩}{⟨date⟩}{\PassOptionsToPackage{⟨option⟩}{⟨package⟩}}{} doesn't pass ⟨option⟩ to ⟨package⟩?

My current version of parskip is 2021-03-14 so: \IfPackageAtLeastTF{parskip}{2018-08-24}{\PassOptionsToPackage{indent}{parskip}}{} \usepackage{parskip} should pass the indent option to parskip. But ...
Denis Bitouzé's user avatar
0 votes
0 answers
21 views

How can I adjust the spacing between the number and the title of each level in TOC to create automatically a nested list?

In this code, I have defined custom sectioning formats using the titlesec package. However, I'm having trouble adjusting the spacing between the section numbers and titles, especially when the section ...
Antonio Maria Di Mauro's user avatar
3 votes
2 answers
120 views

Best Practices for Integrating Computer Algebra Systems (CAS) into LaTeX Documents

I am currently working on enhancing my LaTeX documents to involve complex mathematical equations. Managing these equations manually often leads to errors, especially when changing dependent equations ...
Foad's user avatar
  • 983
2 votes
1 answer
51 views

How to trim spaces without expanding what is inside in expl3?

Consider the following pattern: \NewDocumentCommand{\mycommand}{m}{ \myinternalcommand:n{#1} } \cs_new:Nn \myinternalcommand:n{ \tl_if_single:nTF{#1}{TRUE}{FALSE} } and let's say that I want ...
Vincent's user avatar
  • 5,327
3 votes
1 answer
143 views

LaTeX3 regex not working

I have a very strange bug and I guess I am not using LaTeX3 regexes as they are supposed to be used. My current document looks like this: \documentclass{standalone} \ExplSyntaxOn \regex_new:N{\...
Vincent's user avatar
  • 5,327
0 votes
3 answers
60 views

In Latex3, how to test if all tokens in the input verify a test (for example \token_if_letter or \token_if_space)?

In Latex3, I would like to write a function that checks if every token of an input verify a predicate. Basically I would like the multitoken version of this command: \NewDocumentCommand{\mychecksingle}...
Vincent's user avatar
  • 5,327
6 votes
2 answers
359 views

if_exist macros in LaTeX 3: what are they doing if they do not check the type of things they are supposed to check?

In the documentation of interface3, for several macros with the pattern xxxx_if_exist for xxxx being bool, str, seq and many others the following appear: Tests whether the <boolean> is ...
Vincent's user avatar
  • 5,327
1 vote
1 answer
203 views

Is LaTeX a programming framework of TeX?

My take from What is the difference between TeX and LaTeX? is that TeX is the programming language that renders the document. LaTeX is a well-known macro package for TeX with the aim to make the ...
Ooker's user avatar
  • 1,510
3 votes
3 answers
650 views

Put many images into multiple pages programmatically

I have many images, for example image01.jpg image02.jpg ... image80.jpg I want to put those images into a document, 8 images per page, 4 rows and 2 columns (assume they will fit into one page that ...
Lu Xu's user avatar
  • 137
10 votes
1 answer
384 views

Moving from pgfkeys to latex3 key-val system to handle package options

I have been advised in this question to move from pgfopts to latex3 to handle package options. I would like to do that but I must admit that I am a little lost. Examples with the patterns I'm using ...
Vincent's user avatar
  • 5,327
4 votes
2 answers
94 views

Difference betwen .is family and .cd in pgfkeys in the context of package writing?

I am using pgfopts to create my own packages and handle options. .family and .cd can be used to group the package options together, but I am not sure to understand the pros and cons of each approach, ...
Vincent's user avatar
  • 5,327
5 votes
3 answers
236 views

Counting the number of occurences of specific characters in a string in an expandable way

This question shows how to count the number of occurrences of a specific character in a string. I would like to do it in an expandable way, and for a list (not only one) of specific characters. \...
Vincent's user avatar
  • 5,327
0 votes
0 answers
95 views

Detect if something is a length?

Is there a way in LaTeX to detect if something is a length with a function of the form: \NewDocumentCommand\iflength{m m m}{%CODE HERE%} where: the first parameter is the thing to be tested the ...
Vincent's user avatar
  • 5,327
0 votes
2 answers
114 views

A macro to check command expandability

I would like to create a command that checks whether an expression is fully expandable, and crashes if not (ideally printing an error message). I would like to do that without a specific TeX engine in ...
Vincent's user avatar
  • 5,327

15 30 50 per page
1
2 3 4 5
44