I am using the following code

     \displaystyle{\frac{1}{2}}& 5 \\
     \displaystyle{\frac{1}{2}}& \displaystyle{\frac{11}{22}} \\
     \displaystyle{\frac{1}{2}}& 5

I get the following output on overleaf

enter image description here

I have two problems with this. There is no space between the rows and the horizontal line and the fraction is not aligned nicely with the number in the last column.

I would appreciate any suggestions to fix these problems. I need a solution that works with KaTeX so loading special packages is not possible.

  • Few comments: displaystyle does not take arguments; displaystyle + frac = dfrac; instead of hline try midrule from booktabs, it has better build in spacing – daleif Dec 14 '19 at 9:27
  • Overleaf did not recognize dfrac, this is why I used displaystyle. As I said in my post, I cannot load packages and \midrule is not supported by KaTeX. – Ferenc Beleznay Dec 14 '19 at 9:37
  • Note that katex and mathjax are off off topic here are they are not latex based and thus practically any solution we give you will not work in katex or mathjax (katex is even more limited than mathjax). As long as amsmath is loaded dfrac is available, mathjax supports it, katex probanot. – daleif Dec 14 '19 at 9:40
  • I know dfrac, katex supports it. I did not use it because overleaf does not recognize it by default and I am supposed to give a minimal example. With dfrac the result is the same. I can now sort out the line spacing (using \vphantom{} ), but I still have the horizontal alignment issue. – Ferenc Beleznay Dec 14 '19 at 11:14
  • \\[5pt] instead of \\ works in KaTeX. – Skillmon Dec 14 '19 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.