Skip to content
This repository was archived by the owner on Sep 28, 2023. It is now read-only.

avoid "double subscript" errors when nesting#67

Merged
Daniel-Diaz merged 1 commit intoDaniel-Diaz:masterfrom
NorfairKing:safe-braces
Jan 2, 2016
Merged

avoid "double subscript" errors when nesting#67
Daniel-Diaz merged 1 commit intoDaniel-Diaz:masterfrom
NorfairKing:safe-braces

Conversation

@NorfairKing
Copy link
Copy Markdown
Contributor

No description provided.

@NorfairKing
Copy link
Copy Markdown
Contributor Author

Is there any way to have travis retry the build here? I think it was flaky.

@Daniel-Diaz
Copy link
Copy Markdown
Owner

This seems like a good idea. I just hope it doesn't change semantics for existing code (not counting cases that are not compiling).

Thanks!

Daniel-Diaz pushed a commit that referenced this pull request Jan 2, 2016
avoid "double subscript" errors when nesting
@Daniel-Diaz Daniel-Diaz merged commit 35fd9d2 into Daniel-Diaz:master Jan 2, 2016
@NorfairKing
Copy link
Copy Markdown
Contributor Author

I just found some semantics that could be changed by this.
But only for summation and products etc.
The comprehensions with a big symbol at the start, some math above and below it, and then some more math. Like sum_{i=1}^{n}i etc.

For those you will need the 'unsafe' version:

-- | Unsafe (in the first argument) Subscript.
(.!:) :: LaTeXC l => l -> l -> l
x .!: y = x <> raw "_" <> braces y

-- | Unsafe (in the first argument) Superscript.
(.^:) :: LaTeXC l => l -> l -> l
x .^: y = x <> raw "^"  <> braces y

-- * Comprehensions
compr :: Note -> Note -> Note -> Note -> Note
compr sign lower upper content = sign .!: lower .^: upper <> braces content

comp :: Note -> Note -> Note -> Note
comp sign lower content = braces (sign .!: braces lower) <> braces content

sum :: Note -> Note -> Note -> Note
sum = compr $ commS "sum"

I'm not sure where you used this in HaTeX because I've redefined it in my code.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants