0xacx / chatGPT-shell-cli

Simple shell script to use OpenAI's ChatGPT and DALL-E from the terminal. No Python or JS required.
https://gptshell.cc
MIT License
1.11k stars 157 forks source link

LaTeX doesn't work well with shell. #70

Closed aaaaaQIE closed 1 year ago

aaaaaQIE commented 1 year ago

When chatGPT replies mathematical expression in $\LaTeX$ , some symbles will be transferred to what I don't want. Mainly due to it functioning as an escape character.

Cases:

1. The missing "\f"

Enter a prompt: What is the Maclaurin formula of $\arcsin x$ ?

chatgpt The Maclaurin series formula for $arcsin(x)$ is:

$arcsin(x)=\sum_{n=0}^{\infty} rac{(2n)!}{4^n(n!)^2(2n+1)}x^{2n+1}$

While "\frac" is the correct response.

2. The missing "\t"

Enter a prompt: $\theta=3x+2$ ,what is $x$?

chatgpt Without additional information or an equation to solve for a specific value of $heta$, it is not possible to determine the value of $x$ from the given equation $ heta = 3x + 2$.

While "\theta" is the correct response.

Additionally, I tried to make chatGPT answer in single quotation marks. But that does not work at all either.

mountaineerbr commented 1 year ago

The read command is set as read -e in this script. In this case, try typing \\f for \f and \\theta for \theta.

However, do note that when this is read in json syntax, \t will mean <TAB> and \f will mean <FORM-FEED>, so maybe you will need to escape the backslash with something like \\\\theta (as in the case of pos arg input).

If read -e -r were set, then typing a single backslash would be the equivalent of one backslash.

Note that however if -p "[prompt]" is set from pos args, then one may type either "\\\\f", or '\\f' for \\f symbol (this is just an escaped \f).

aaaaaQIE commented 1 year ago

Everything fixed after installing glow .