Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reformat LaTeX source of tables for better parsing and diffing #7

Open
jcrippen opened this issue Jul 10, 2020 · 0 comments
Open

Reformat LaTeX source of tables for better parsing and diffing #7

jcrippen opened this issue Jul 10, 2020 · 0 comments

Comments

@jcrippen
Copy link
Owner

jcrippen commented Jul 10, 2020

The LaTeX source code currently represents each row of a table as a single row of text. This makes it easy to read the source, but it actually complicates some automatic tooling. Even if only a single character is changed in one cell, diff considers the entire row to be different. Since the rows are very long this makes interpreting diffs – and thus git output – very hard. It also makes the data harder to parse since a program has to know quite a bit about LaTeX table syntax to pick apart the individual cells in each row.

An alternative format is to put each cell on its own line in the LaTeX source. A line like

cell 0 & cell 1 & cell 2\\

would instead be something like

cell 0
      & cell 1
              & cell 2\\

So that each cell is on a separate line. A change made to a single cell would be seen in a diff by the change of a single line. Parsing a row would be reading each line up to one ending with \\ and then filtering the LaTeX cruft like &. Since each cell is on its own line, the count of lines in a block would track the number of cells in a row and thus make indexing simpler.

@jcrippen jcrippen changed the title Reformat LaTeX source of tables for better parsing/diffing Reformat LaTeX source of tables for better parsing and diffing Jul 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant