DRMF / texer

Replaces macros in .tex files
0 stars 1 forks source link

Implement macro replacement for \pochhammer{a}{n} #9

Open poortho opened 8 years ago

poortho commented 8 years ago

From @HowardCohl on July 15, 2015 18:22

If you have some math in LaTeX such as

(a)_n this string should be replaced by \pochhammer{a}{n}.

Similarly

\left(a\right)_n 
\Biggl(a\Biggr)_n
(a)_{n}
(a)_{{n}}
(\mu)_\alpha

as well as

(\;a)_{\ n}

should also be replaced by \pochhammer{a}{n}

\left( and \Biggl( are all ways to represent parentheses. \; and \ are space delimiters and should be ignored.

Copied from original issue: DRMF/texvcjs#10

poortho commented 8 years ago

From @physikerwelt on July 15, 2015 22:24

:+1: Yes. But please make that an optional feature that can be switched on or off via config It should perform replacements based on the AST

poortho commented 8 years ago

From @HowardCohl on July 17, 2015 16:8

Ha. An optional parameter for the main feature the program is specifically designed to perform. Isn't that like "print -print x", saying we should print x but only if the -print option is specified. :)

What's an AST?

poortho commented 8 years ago

From @physikerwelt on July 17, 2015 17:25

AST is abstract syntax tree.

parameter:To keep the program compatible to the wikimedia texvcjs program this would be nice to follow a modular design here. I would not pass the parameter as commandline argument but define that in a config file

poortho commented 8 years ago

From @physikerwelt on July 17, 2015 17:26

print -print reminds me to git clean

poortho commented 8 years ago

You said that

\Biggl(a)\Biggr)_n

should return \pochhammer{a}{n}, but there seems to be an extra right parenthesis there (both a ")" and "\Biggr)", is this intentional?

poortho commented 8 years ago

From @HowardCohl on July 22, 2015 13:34

You're right Claude. It should be \Biggl(a\Biggr)_n. I will correct the original comment.

But of course these are just examples of ways to insert parentheses. There are many more such as:

\big(...\big) \Big(...\Big) \bigg(...\bigg) \Bigg(...\Bigg)
\bigl(...\bigr) \Bigl(...\Bigr) \biggl(...\biggr) \Biggl(...\Biggr)
\left(...\right)
(...)
poortho commented 8 years ago

I have tried doing this but with limited success. I was able to make it perform the replacement if it was a single character as a and n but the parsing does not work if it is a LaTeX command or multiple characters due to the way that the program handles parentheses and underscores normally. I eventually got pretty frustrated and started working on issue #18, and will probably come back to it after I completely solve issues #15, #18, and #16.

poortho commented 8 years ago

Can the command inside the parenthesis be a string of more than one character? For example, could it be like this:

(abcd)_{\commandname}
poortho commented 8 years ago

Also, if the second argument was like this:

(a)_abcd

should I return \pochhammer{a}{abcd} or \pochhammer{a}{a}?

poortho commented 8 years ago

From @HowardCohl on September 18, 2015 21:32

Yes you could have (abcd)_{\commandname} for instance you could have (abcd)_{\alpha} or you could have (abcd)_\alpha. This works also.

If you have (a)_abcd then you should return \pochhammer{a}{a}bcd. Does this make sense?

poortho commented 8 years ago

From @HowardCohl on October 13, 2015 21:19

Once you finish this, it should be easy for you to implement \qPochhammer.

This will be, for instance,

(a;q)_n to be replaced with \qPochhammer{a}{q}{n}

It has to look for a semicolon to separate the a and the q.

poortho commented 8 years ago

From @physikerwelt on April 1, 2016 18:27

Github has new (simplified way of tracking the status) You can create lists of the sub-issues that need to be resolved.