3
$\begingroup$

Mathpix is a tool which can covert $\TeX$ image to $\TeX$ expression, they also say they can return a string which is compatible with the Wolfram Alpha engine if possible.

I found their documentation and did such an attempt:

doc: https://docs.mathpix.com/#processing-a-single-image

img = Import@"https://raw.githubusercontent.com/Mathpix/api-examples/master/images/limit.jpg";
base64 = ExportString[ExportString[img, "JPEG"], "Base64"];
HTTPRequest[
    "https://api.mathpix.com/v3/latex",
    <|
        "Method" -> "POST",
        "Headers" -> {
            "app_id" -> "trial",
            "app_key" -> "34f1a4cea0eaca8540c95908b4dc84ab",
            "Content-type" -> "application/json"
        },
        "Body" -> {
            "src" -> "data:image/jpg;base64," <> base64,
            "format" -> <|"wolfram" -> True|>
        }
    |>
] // URLExecute[#, "RawJSON"]&

Then Mathematica kept asking me to input Authentication Require, and no matter what I do with that, it always return:

<|
    "error" -> "Invalid credentials",
    "error_info" -> <|
        "id" -> "http_unauthorized",
        "message" -> "Invalid credentials"
    |>
|>

I don't know what Authentication Require is, can I avoid jumping out of that verification.

$\endgroup$
5
  • $\begingroup$ For github.com/oovm/Mathpix, How do you set the key in PersistentValue["Mathpix", "Local"]={"$KeyName","$KeyValue"};? Is "$KeyName" supposed to be replaced with a string representing the keyname? And what is the key name? $\endgroup$
    – ions me
    Commented Apr 12, 2021 at 8:19
  • $\begingroup$ It's the trial key, if you don't set your own key, this will be used by default. This key was valid before, but now it seems to have been cancelled. $\endgroup$
    – Aster
    Commented Apr 12, 2021 at 13:09
  • $\begingroup$ So I'm assuming the App ID and the App Key from our account on the mathpix website get pasted in inside the quotes? imgur.com/a/UKpR9EQ $\endgroup$
    – ions me
    Commented Apr 12, 2021 at 20:10
  • $\begingroup$ Or do we on a separate line put $KeyName = myusername123 $\endgroup$
    – ions me
    Commented Apr 12, 2021 at 20:11
  • $\begingroup$ Also, it seems like running this : ResourceFunction["GitHubInstall"]["GalAster", "Mathpix"] doesn't provide a Mathpix function. ? Mathpix returns Missing["UnknownSymbol", "Mathpix"] $\endgroup$
    – ions me
    Commented Apr 12, 2021 at 20:18

1 Answer 1

2
$\begingroup$

Try Mathpix API in Mathematica

https://github.com/Moe-Net/Mathpix

$\endgroup$
3
  • $\begingroup$ Isn't that created by the very same person who asked the question above? :-) $\endgroup$
    – Szabolcs
    Commented Apr 5, 2019 at 17:17
  • $\begingroup$ This api do not work $\endgroup$
    – capea
    Commented Dec 31, 2020 at 18:42
  • $\begingroup$ please could you help to undestoodhow itis work $\endgroup$
    – capea
    Commented Jan 1, 2021 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.