Skip to main content

Questions tagged [parsing]

{parsing} is the process of analysing a string of symbols, either in natural or computer language.

Filter by
Sorted by
Tagged with
0 votes
0 answers
54 views

Unstable ATS parser results [closed]

I am editing my resume to make it ats friendly. I have numerous parsing problems. with adding or removing sth, my parsing result in enhancv ats parse rate goes from 100% to 42% then comeback to 97% ...
Farhang Amaji's user avatar
1 vote
2 answers
42 views

Splitting string and retrieving part of it

I would like to take a string in Beamer and retrieve part of it. The solution at How do I split a string? gets me very close to what I want; but using it as example, i.e. if the string is: \def\...
Rigel F. do C.'s user avatar
3 votes
4 answers
286 views

In(de)finite number of Boolean arguments

I would like to know if it is possible to program a function that would accept a given symbol an infinite number of times. The application I have in mind is the following. I would like, if possible, a ...
Vincent Krebs's user avatar
2 votes
1 answer
109 views

How to parse a `key[value]` string with the package listofitems

Through two previous answers by @StevenB.Segletes (1 and 2), I'm 99% able to parse the 4 most important fields in SGF files/strings: B and W for Black and White moves, respectively; AB and AW for ...
psygo's user avatar
  • 438
2 votes
1 answer
83 views

Problems expanding a variable inside a `\foreachitem` using the package `listofitems` and a macro

Following this answer by @StevenB.Segletes, who's also one of the creators of the package listofitems, I'm now trying to use what that package was able to parse from a single-branch SGF string inside ...
psygo's user avatar
  • 438
2 votes
2 answers
88 views

Parsing a Flat SGF String (with the Package listofitems)

I'm trying to parse an SGF string with the package listofitems. SGFs are trees in text form, but right now, I'm working on only single-branched SGFs, for simplicity. Here's an example of what I'm ...
psygo's user avatar
  • 438
2 votes
1 answer
132 views

Parsing the Main Branch of Single-Branched SGF Files (with Regex?)

What I'm trying to accomplish is to parse an SGF file (a text file) into a TikZ diagram, something like this (ideally, I would point to the SGF file itself, instead of inlining a string): \parsesgf{(;...
psygo's user avatar
  • 438
1 vote
1 answer
75 views

\regex_match is not working as expected

I have the following macro and the following input: \def\something#1{ \regex_extract_all:nnN{ ([A-Za-z]{1}\d{1,2})\s*-\|\s*([A-Za-z]{1}\d{1,2}) }{#1}\l_my_seq \...
gxono's user avatar
  • 142
8 votes
1 answer
300 views

Seeking Enhancements and Solutions for Dynamic LaTeX Command Substitution

I am engaging with the community to seek insights and possible solutions for a LaTeX macro customisation. This is inspired by a discussion in this thread, which explores the possibility of dynamically ...
KevinHeart's user avatar
0 votes
2 answers
50 views

ifthenelse with mismatched braces [duplicate]

I am writing some lecture notes, and I would like to have automatically generated two versions. One version includes everything (examples, additional explanations, etc.), and another one with only the ...
D.F.F's user avatar
  • 414
2 votes
1 answer
97 views

How to parse square bracket arguments into several curly braced arguments?

I have an environment which I specify w/... \begin{code}{TITLE}{LANGUAGE}{CAPTION} \end{code} I'd like be able to specify it instead like... \begin{code}[title={TITLE},language={LANGUAGE},caption={...
user41177's user avatar
  • 375
1 vote
1 answer
180 views

bibleref-parse package: typeset repeated books as separate entries

The code \documentclass{article} \usepackage{bibleref-parse}% \usepackage{makeidx} \makeindex \begin{document} \pibibleverse{John 3:16;5:12;1Co 3:12-14,18} \printindex \end{document} typesets the ...
Tom Price's user avatar
  • 374
0 votes
1 answer
93 views

How to recreate this CYK parse table

I would like to use something that looks like the following table in my document, but I have no idea of how to make this using TikZ or other packages. Using a matrix leaves too much empty space above ...
Dexterous's user avatar
0 votes
1 answer
113 views

My wheel chart displays fine but I have an error in the logs

I am trying to create a wheel chart and it displays almost fine but i still have an error: Package tikz Error: Cannot parse this coordinate. ‪main.tex, 32‬ See the tikz package documentation for ...
Balansoire's user avatar
3 votes
4 answers
68 views

Parsed word segment in second function can not be compared to string in latex?

I would like to parse words by removing always the last segment ("1. Book1 p3" becomes "1. Book1" or "Book2 p4" becomes "Book2"). This I achieved with the ...
ISE's user avatar
  • 31
0 votes
1 answer
50 views

Language question: with \x defined as <X>, why using command \x is not the same as using <X>

This is intended more as a LaTeX language question than a "how do I accomplish XYZ" question. In the code below, a usage of VerbatimOut is successful. Place that usage inside a \newcommand* ...
David Fink's user avatar
3 votes
2 answers
98 views

How to make plain text be understood as a macro?

I'd like to create an environment, which will have its own parsing rules inside, for example: \begin{foo} a := 42; c := a; \end{foo} Would be understood as: a \mapsto 42 \\[2pt] c \mapsto a \\[2pt] ...
yegor256's user avatar
  • 12.2k
1 vote
2 answers
47 views

Using string to process a macro name using listofitems seems to fail

I am trying to process the name of a command using listofitems, but when I am using \string to convert that command it does not behave the way I think it would behave. Here is a code to illustrate: \...
Vincent's user avatar
  • 5,327
7 votes
5 answers
350 views

Does a package exist for programmatically (incrementally) constructing a macro?

When using LaTeX, I often find myself desiring a way to programmatically construct a macro using a series of instructions rather than in the usual "template" sense. By "programmatically&...
COTO's user avatar
  • 371
2 votes
0 answers
99 views

Detect \end of an environment

I'm trying to create a macro that grabs everything till the end of the current environment and parses it. At first, I just want to put ! right after my macro and another one ! before the end of ...
antshar's user avatar
  • 4,642
1 vote
1 answer
111 views

How to parse an itemized list the way moodle.sty does

A simple moodle.sty database contains code like that: \begin{multi}{Name of the question} Text of the question \item first answer \item secon answer \item* the starred is the ...
user126154's user avatar
2 votes
2 answers
234 views

How to gobble a character, if present

I would like to do the folloging: Given a (complicated) string/macro \String, if it starts with * I just remove it, otherwise I do nothing. So far I tryed \def\gobbleast *{}% then \gobbleast \String ...
user126154's user avatar
1 vote
0 answers
2k views

Is there a way to extract math from a pdf in LaTeX format using SESHAT?

So I've been tasked with using SESHAT to extract the math problems from a large pdf into latex format, but seshat requires an InkML or SCGink file type as it's input. Is there a way I can convert pdf ...
JustLearning321's user avatar
2 votes
1 answer
173 views

Parse subscript and superscript in command

I am using quite a lot of notation in my text. Thus, I decided to write some commands such as: \newcommand{\struct}[1]{\mathsf{#1}} The typical use is as follows: Let $(\struct{A}_n)$ be a sequence ...
Tomáš Hons's user avatar
0 votes
0 answers
149 views

Coloring numbers outside string and variables using lstlisting and parsing don't work as expected. Need Help to fix with PDFLaTeX

I am writing my thesis and i need to put extract of code into it. Having developed all my C# code in Visual Studio, I would like to have more or less the same colors, so I have taken different ...
Matteo Di Fabio's user avatar
7 votes
3 answers
273 views

Are there any LaTeX commands (including in packages) where the argument will be in math/text mode based on context?

As I work on the parser for finl, I'm contemplating how I'm dealing with command parameters and wondering if my current setup is sufficient. Right now, a parameter has a type which would either be ...
Don Hosek's user avatar
  • 14.2k
3 votes
2 answers
368 views

Parse list of tuples

I want to pass a list/sequence of "tuples" to a macro, like this: \foo { (value11 value12 value13) (value21 value22 value23) (value31 value32 value33) (value41 value42 ...
Noldorin's user avatar
  • 920
1 vote
2 answers
249 views

Gobble the next char if it is whitespace or tilde

I want this macro to gobble the next character in the input stream only if it is whitespace (according to the char code) or it's the tilde character (i.e., a non-breaking space). My current attempt to ...
Noldorin's user avatar
  • 920
4 votes
3 answers
106 views

How to absorb the content of the page into a variable?

This is what I'm trying to do: \documentclass{article} \begin{document} \start Hello, world! \stop \print % here! \end{document} I'm expecting Hello, world! to be printed twice. The second time by ...
yegor256's user avatar
  • 12.2k
6 votes
3 answers
369 views

Split string into part by char position

Explanations I format a moroccan RIB (Relevé d’identité bancaire for “Bank account number”) to display it as a nice rendering. I need to take each part of the RIB to embrace it with a specific label. ...
fauve's user avatar
  • 2,531
1 vote
1 answer
63 views

Macro delimited lists

Floats use macro delimited lists like \@freelist. Source2e shows them using macros like \@next and \@cons without showing the definitions. The idea of having self parsing lists is intriguing and ...
John Kormylo's user avatar
  • 81.2k
1 vote
2 answers
159 views

Automatically composing documents from multiple text files which are not LaTeX formatted?

I'm looking for a way to create a songbook out of individual song files. Each song file is a self-contained block of text data consisting of: Song name Song author Some details (optional) Lyrics with ...
Petr Doležal's user avatar
9 votes
4 answers
531 views

LaTeX3 - Parsing an argument to apply specific macros

In the following code, I would like to parse the argument of \parseanduse such as to "achieve" the examples shown. Each time a o is met, the following integer should be used to call the ...
projetmbc's user avatar
  • 13.4k
1 vote
1 answer
195 views

ConTeXt: Typeset XML attribute containing newlines

Background A user can provide their address information in a text area, separating lines by pressing Enter. An XML document is generated, which replaces the new line character with \n, such as in the ...
Dave Jarvis's user avatar
1 vote
1 answer
440 views

Parsing optional argument from \newenvironment to \newmdenv

I'd like to parse an optional variable from a custom \newenvironment{example} to an mdframed environment \mytextbox nested in the example environment. What I'd like to achieve is something like ...
Jean Jordaan's user avatar
5 votes
1 answer
321 views

Parsing a mix of plain text and commands

I am trying to implement a command that parses some expression that can be a mix of plain text, commands with their (any number of) arguments, or even -- if I understood that correctly -- unexpandable ...
kmft3kte's user avatar
9 votes
2 answers
378 views

LaTeX3: Elegant way to forward-reference a counter with a "future" value

I'd like to do, pseudo-code, the following: \begin{pointtracker}{Advanced Geology} \begin{itemize} \item Count the fingers on your left hand. Are there more than 9? \addpoints{1} \item Draw ...
Marcus Müller's user avatar
1 vote
1 answer
63 views

lstlisting: Unexpected newline/missing background color after trailing space in escape section

I'll start with a minimum failing example: \documentclass{article} \usepackage{listings} \usepackage{color} \lstdefinelanguage{x}{ escapechar={!} } \lstset{language=x, breaklines=true, ...
Christoph Thiede's user avatar
1 vote
1 answer
1k views

Parsing issues with resume written in LaTeX [closed]

I've written my resume in Overleaf and downloaded it as a PDF to submit to job applications. For some job applications it works but for others I'm told there is a parsing error (i.e. their automated ...
Andrew's user avatar
  • 111
5 votes
1 answer
310 views

Automatic text highlighting based on a dictionary

I would like to automatically highlight parts of a running text, based on whether the word is in a predefined dictionary, or not. Something along the lines of... \documentclass{article} \mydictionary{...
Matsmath's user avatar
  • 936
0 votes
2 answers
87 views

Weird 'ProvidesPackage' vs 'newenvironment' macro expansion

currently improving an existing package ('ditaa', based on ditaa0_9.jar) to add support for svg (implemented in ditaa-0.11.0-standalone.jar) yet I'm facing strange macro definition/expansion. ...
Kochise's user avatar
  • 155
16 votes
1 answer
11k views

is there a python module for parsing LaTeX?

I am looking to write python programs that modify LaTeX source files. To do this I would like to have a basic parser in python that can reliably read and write LaTeX files while maintaining the tree. ...
vy32's user avatar
  • 4,810
1 vote
0 answers
114 views

Macro to change the extension of filename

I would like to have a macro to change the extension of a file name. For example, my macro needs to take an argument like Figures/Fig.xxx and return me Figures/Fig0.yyy. I found a solution in Extract ...
MahiPai's user avatar
  • 91
3 votes
2 answers
324 views

Convert \input to number

I'm reading several txt-files from disk and I want to do some simple calculations on them and be able to print them on the page. Basically I have: \newcommand\getinput[2]{ \immediate\write18{do-...
RazorHail's user avatar
  • 157
6 votes
4 answers
529 views

What LaTeX macros cannot accept a group as an argument?

I am working on a LaTeX pretty printer that parses a LaTeX document and then re-renders the source. (I know that this is not possible in all cases, but it should be possible a lot of the time.) In ...
Jason Siefken's user avatar
0 votes
0 answers
35 views

Automatically elaborate an external table's data

I have to create a serie of sheets with LaTeX using informations from a LibreOffice table (but I can convert it in other formats if needed). The problem is, the table is some hundreds rows long, so it ...
Ntakwetet's user avatar
  • 631
6 votes
1 answer
542 views

Why does LaTeX parse square brackets differently than curly braces?

In this comment (copied below without effort to preserve formatting): It may be worth pointing out why this happens. The [ and ] bracketing of optional arguments in LaTeX isn't as robust as the { .....
Kimball's user avatar
  • 313
3 votes
1 answer
505 views

How to escape "and" as list delimiter in bibtex/biblatex?

In my BibLaTeX manual, it says: Literal lists are parsed and split up into the individual items at the and delimiter but not dissected further. Literal lists may be truncated in the bib file with ...
sdaau's user avatar
  • 17.1k
3 votes
3 answers
356 views

Parse sentence and split into parts

I would like to generate titles for my documents that look like this: \documentclass{article} \usepackage{tikz} \begin{document} \noindent \colorbox{red}{\expandafter\MakeUppercase\expandafter{\Huge ...
Mike's user avatar
  • 416
4 votes
2 answers
374 views

In LaTeX3, what is the best data type for storing, parsing and outputting free user input?

I'm working on a mini-parser that takes free user input and interprets certain inputs as commands. For example, the parser interprets + as \oplus or [ as "start a pre-configured array with the bracket ...
Felix Emanuel's user avatar

1
2 3 4 5