ppizarror / PyDetex

An application that transforms LaTeX code to plain text
https://pydetex.readthedocs.io
MIT License
34 stars 5 forks source link

support \citeauthor #28

Closed xionghuichen closed 2 years ago

xionghuichen commented 2 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

\citeauthor will be removed after the PyDetex process and make a sentence lack subject. e.g.,

On the other hand, \citeauthor{article} do something. -> On the other hand, do something.

Describe the solution you'd like I think a solution is replacing \citeauthor{} with a placeholder.

e.g.,

On the other hand, \citeauthor{article} do something. -> On the other hand, [authors] do something.

ppizarror commented 2 years ago

Hi. I think this is a nice addition =)

ppizarror commented 2 years ago

Hi! @xionghuichen can you work on it?. If not, I can add this new feature in the mid-term. The good news is this project has tons of tests, so the changes you're breaking something are low 🍔 .

xionghuichen commented 2 years ago

Great! I am glad to do that. But it maybe needs some time before I am free to add the feature.

ppizarror commented 2 years ago

Hi! I've added support for citeauthor, see https://github.com/ppizarror/PyDetex/commit/7c42ad5ffc70b32b9d80eb13b89cd4b0ce6e7320

Usage:

Input:

hello \citeauthor{number1,number2} epic
hello \citeauthor{number1} epic

Output:

hello [authors] epic
hello [author] epic
ppizarror commented 2 years ago

Also I've added tons of new features. Such as lots of new replace tags, support for \enquotes, and fix \$ symbols. Let me know what you think, and I'll release this new version :)

xionghuichen commented 2 years ago

Thanks for the update! I have tested the feature of citeauthor, and it works :) The implementation is also elegant to me. I think the only problem is the comment of function "process_citeauthor" (line 317~ line 318 in 7c42ad5ffc70b32b9d80eb13b89cd4b0ce6e7320) is incorrect. It seems to be the comment of function "process_cite".

ppizarror commented 2 years ago

Thanks. Fixed in in cd52b6eaa64e5b48a953dec052c8c3145386a30f. Also fixed \hl{} command

xionghuichen commented 2 years ago

I have no other question 🎉

ppizarror commented 2 years ago

I'll submit the new version. Thanks 😄

ppizarror commented 2 years ago

New v0.9.4 uploaded!