I intended to make this a comment, but this account is new and I don't have enough reputation to comment.
Thank you so much for your answer, it worked for me! But do you know how to make this an inline formula? Right now it generates a new line for every formula I have, thank you so much!