This question already has an answer here:
I know that this question is not new but as I look at the answers, like,
I realize that these threads are old. Since Matlab itself has included many functionalities to address this issue, I am wondering if the community can post some updated methods.
Also it will be nice if answers can address the issues one might face if one is using an online template for making \LaTeX documents like overleaf.com