This has been discussed before in math markdown on this site, but I'd like to have some fresh discussion of this matter. Circumstances have changed in the meantime. The discussion of 2011 seems to consider it a foregone conclusion GDSE can't & won't get MathJax, but sites such as RPG Stack Exchange and Code Review and Worldbuilding have been granted MathJax, so that's no longer the case. I think it's worth having a fresh discussion of the matter; none has happened since 2011 because each subsequent time the issue has been raised it's been closed as a duplicate of that 2011 discussion. Jeff Atwood called it a heavy dependency, but that was in 2010, and MathJax's client-side performance has improved since then to be pretty smooth.

I believe it would be beneficial for GDSE to have MathJax enabled, and it's likely we could actually get it if we can show we'd benefit from it — which I am sure we can.

As Shog9 said in response to Code Review's request for MathJax:

Unless there's a large population of posts that could benefit extensively from it, there's no need to impose the cost on the rest of the posts. A few subscripts don't really necessitate this.

I believe there may well be such a large population of posts. Game development can get very mathematical: matrices, vectors, quarternions, projections, rotation, probability, physics, and graphics operations, are all mathematical subjects that are standard fare for us.

In one prior meta request, a user expressed they would prefer to use math formula, but used psuedocode because it was all that was available.

As was the case on on RPG Stack Exchange, the standard delimiter of $ ... $ would be an issue, so we could instead use delimiters of \$ ... \$ for inline MathJax, and $$ ... $$ for block-level MathJax.

  • 12
    Since all the concerns about this feature are from ancient times (i.e. performance, bandwidth, browser support), I'm absolutely supportive of it. – John Hamilton Jun 8 '17 at 11:01
up vote 4 down vote accepted

We're going ahead and enabling this, as you've shown plenty of examples of cases where it'd be useful.

As requested, the inline delimiters will be changed to \$ ... \$, and the block-level delimiters are $$...$$ and [...] (which are the defaults, and can't be changed).

Fixed posts broken by this:

  • 2
    Woohoo! 🎉 Thanks for enabling this! – doppelgreener Dec 12 '17 at 17:37

This is a community wiki post anyone can edit.

Its purpose is to compile a list of Game Dev SE posts that would significantly benefit from MathJax/LaTeX markup, as part of the use-case argument for enabling MathJax here.

We need a decent body of evidence that MathJax would be worthwhile. RPG.SE and CodeReview responded by gathering a list of posts that would benefit significantly from MathJax, and the request was eventually implemented.

I believe such a body of evidence exists to be found. We just need to do the legwork to demonstrate it exists, so I invite others to participate in uncovering it.

This post already includes the posts mentioned in previous community requests for MathJax, which I am listing to ensure coverage and to indicate positive community sentiment for this feature: How can I render math formulas from StackExchange in my web browser?, Latex Integration, TeX should be supported on GameDev, like on Math.SE, Physics, et. al, Why don't we have LaTeX?, Can we have MathJax on gamedev.SE?.

A word on pseudocode

Many GDSE posts use pseudocode to represent maths. That's frequently useful to do when showing how to implement something natively in code.

Sometimes however it's not the most effective means of communicating mathematics, and reading the post it looks like pseudocode has largely been used just because it's the only real option available. Things like saying cross(vector1, vector2) can be simply expressed in either MathJax or pseudocode, and sometimes it's simpler and cleaner as MathJax.

Sometimes pseudocode is expressing how to implement a very complex formula in code form, which is also extremely useful! This stuff should remain as-is. However, often it's difficult to understand what basic mathematical formula is actually happening, when it could be something as simply annotatable as a matrix-on-vector transformation. These pseudocode blocks would greatly benefit from being accompanied by a MathJax representation of what they're implementing.

I can't read into all the cases where an author might've been happier writing out their pseudocode as MathJax, but I'm making an educated guess as to scenarios that would've been better that way, or where it would at least be excellent to have a choice to use MathJax.


List of posts that would improve with MathJax

Pseudocode that is preferable being left as-is and is entirely adequate without a corresponding MathJax formula has not been counted for the purposes of this list. Real code that is used or intended for use in a real codebase is not counted. Deleted posts and posts with trivial uses of mathematical notation (i.e. MathJax would likely not improve clarity) are not counted. Answers to closed questions have been included.

The symbol indicates the post is either already using LaTeX via images, or is using code blocks and/or unicode to represent complex mathematical symbols and/or layout for complex formulae.

  1. Detect mouse click on a bezier curve's neighborhood
  2. Adding air drag to a golf ball trajectory equation
  3. How to achieve uniform speed of movement on a bezier curve?
  4. How to compute acceleration by using Kinect device joint positions ‡ (actually tried writing literal mathjax syntax, which doesn't parse. weird. maybe they were expecting readers to use one of those mathjax-parsing browser extensions / bookmarklets?)
  5. How to compute acceleration by using Kinect device joint positions ‡ (same again.)
  6. Using random numbers with a bias (user has explicitly stated they'd rather use MathJax for this answer)
  7. How do I determine a good path for 2D artillery projectiles? ‡ (user includes a scanned photo of handwritten formulae)
  8. Math behind drawing one game object relative to another? ‡ (matrix and vector notation)
  9. How do I detect the direction of 2D rectangular object collisions?
  10. View Matrix FINDING U
  11. How to solve a pow equation? ‡ (would also benefit from align)
  12. Advanced dice probability
  13. How can I move and rotate an object in an “infinity” or “figure 8” trajectory?
  14. How can I move an object in an "infinity" or "figure 8" trajectory?
  15. How can I move an object in an "infinity" or "figure 8" trajectory?
  16. Find vector tangent to circle through a point
  17. Converting Euler rotation angles from Z up to Y up (Max to OpenGL)
  18. Why is sin = Y and cosine = X?
  19. How can I prevent small numerical advantages from dominating the balance of an encounter?
  20. Problem with Rotating Third Person Radar UE4
  21. C++ and SFML moving a Sprite with a circle equation
  22. Calculate the distance/number of moves one square is from another
  23. How can I project a vector on another vector?
  24. How does one calculate the surface normal, in 2D collisions?
  25. How does one calculate the surface normal, in 2D collisions? (probably)
  26. How can I project a 3D point onto a 3D line? (uses python out of the blue instead of math formula)
  27. How can I project a 3D point onto a 3D line?
  28. What is Vector Projection and what is it's use in games? (but may be better leaving mathjax inside the diagram)
  29. Three points to normal notation (interpret the math)
  30. Three points to normal notation (interpret the math)
  31. Coordinates of the corners of a rectangle bridging two circles
  32. Difference between column- and row vector matrix multiplication (vector transform)
  33. How to work out the height of a point on a tilted surface?
  34. Merge angle range
  35. Approximating a fourth point with a weighted average between three points?
  36. Timebased transition from start to end value
  37. Timebased transition from start to end value
  38. Hemisphere Projection
  39. Calculate damage values from bullet velocity and size
  40. Determine the z coordinate of a deformed plane based on uv (xy) coordinates
  41. Axis of affine transformation matrix
  42. Axis of affine transformation matrix
  43. How can I find a point on a line when I have only two other points?
  44. Finding the Distance between 2 Objects
  45. Computing chance of winning when dealing with fuzzy numbers
  46. Computing chance of winning when dealing with fuzzy numbers
  47. Computing chance of winning when dealing with fuzzy numbers
  48. Computing chance of winning when dealing with fuzzy numbers
  49. Parametric form of a cubic function
  50. Parametric form of a cubic function
  51. Parametric form of a cubic function
  52. Time series for creating new events in a PVP game
  53. Why don't Javascript Math.cos doesn't match this vector tutorial?
  54. clamp a 2D coordinate to fit within an ellipse
  55. clamp a 2D coordinate to fit within an ellipse
  56. how to handle the virtual Z axis in 2D games?
  57. How can I prevent small numerical advantages from dominating the balance of an encounter? (benefits from arrays)
  58. Rotate directly towards a target at a constant speed
  59. How Matrix4 represents an object in space and matrix lore
  60. Translation Matrix not working properly
  61. How to convert -1 to 1 coordinate back to screen coordinates?
  62. What is a simple algorithm for calculating evenly distributed points on an ellipse?
  63. How to calculate the exit speed of ball bouncing off a solid surface
  64. Ray Intersecting Plane Formula in C++/DirectX
  65. Rotate vector by matrix?
  66. How can I find a point on a line when I have only two other points?
  67. How are these physics formulas translated to this code? ‡ (uses screenshots of formulas I'd translate to mathjax to improve legibility)
  68. Calculate matrix transformation components separately
  69. Calculate matrix transformation components separately
  70. How to calculate acceleration and deceleration
  71. How to calculate acceleration and deceleration
  72. How to calculate distance of travel needed get achieve speed x?
  73. How to calculate distance of travel needed get achieve speed x?
  74. Attack vs Defence and who is the winner?
  75. Weighted Random Distribution
  76. Weighted Random Distribution
  77. Get bullet movement direction?
  78. understanding spatial hash function behaviour and Knuth for int64 (would benefit from align)
  79. How to enforce touching within a ring shape?
  80. How do idle games handle such large numbers?
  81. Frustum Culling: How to calculate if an angle is between another two angles
  82. How can I launch a GameObject at a target if I am given everything except for its launch angle?
  83. Accurately simulating the lots of dice rolls without loops?
  84. How can I launch a GameObject at a target if I am given everything except for its launch angle?
  85. Test if Jump can reach target
  86. Computing a full revolution for an arbitrary orbit?
  87. Object orbiting a 3d sphere
  88. Finding pitch/yaw values from lookat vector
  89. Orbital mechanics: orbit as a function of time. Universal variable formulation?
  90. calculating the weights for direction vectors to a target
  91. Get local coords from global coords
  92. Adjust Aim Angle for Motion with Accelerating Bullet
  93. How to draw a circle that is around an object and becomes smaller if the player enters it
  94. How to draw a circle that is around an object and becomes smaller if the player enters it
  95. Returning a List of coords for a sphere in order of inside to outside
  96. Explanation of the parameters in the line intersection code
  97. How can I calculate current level from total XP, when each level requires proportionally more XP? (so many equations)
  98. How can I calculate current level from total XP, when each level requires proportionally more XP?
  99. How can I calculate current level from total XP, when each level requires proportionally more XP?
  100. Algorithm for spending x points on y things divided by n people
  101. Exponential EXP Curve | FIXED TIME -> MAX LEVEL
  102. What's the most optimized way to transform series of points into curves in order to be serialized?
  103. Get all points of a parabola (everything except the code example at the end is formulae)
  104. Calculating the vector to catch a falling object
  105. Find two points in a point cloud with the maximum distance?
  106. Find two points in a point cloud with the maximum distance?
  107. Hex axial coordinates to table coordinates conversion (would benefit from array)
  108. How to work out given two coordinates should I use a vertical/horizontal/diagonal line to connect them
  109. Collision detection with curves
  110. How do you calculate if a line is facing a curve?
  111. How do you calculate the nearest point on 2 curves?
  112. Bezier curve arc length
  113. Moving ships between two planets along a bezier, missing some equations for acceleration
  114. Bezier curve not drawn correctly
  115. Collision detection with curves
  116. Cubic bezier for easing?
  117. Average for damage formula (Min-Max Attack - Min-Max Defense)
  118. How can I transform a Point2f with a matrix on Android?
  119. Path following with Asteroids-like movement. Time to complete path (‡ potentially — or user could've preferred keeping the latex markup intact in the diagrams anyway)
  120. Calculate the slope of a 3D triangle?
  121. How To Program a fully controllable spring (Damped) motion
  122. Calculation correct position of object after collision (2d)
  123. How to find the point on a hypotenuse divinging triangle into two right triangles?
  124. How to find the point on a hypotenuse divinging triangle into two right triangles?
  125. Curvilinear distortion for mapping texture on quad sphere
  126. Calculating pitch angle to hit a target using a projectile that has fixed speed
  127. Finding coordinate in radius (pseudocode)
  128. Calculating orbital elements from Cartesian Vectors
  129. Rotate coordinates back after rotating game context (geometry)
  130. Computing Normals for a displaced material
  131. Given a constant rotation and target point, find position so that point will be in camera center
  132. Non equi-probable random function
  133. Cannot find bug in frustum culling code (lots of plaintext vector definitions that would be presented far more legibly in mathjax)
  134. Detect if two objects are going to collide (equations would benefit from being legibly expressed in mathjax alongside psuedocode)
  135. Calculate intersect point / aim point
  136. Calculate intersect point / aim point
  137. Calculate intersect point / aim point
  138. Rotating a 3rd person camera toward a target
  139. Fast Ray Sphere collision code
  140. Need some help with math steering behavior stopping on destination point
  141. Is there a quick way to determine if a vector is in a quadrant?
  142. How to invert a damage formula? (maybe)
  143. atan2 : inversed result? (angle 180 is on the right side, angle 0 on the left side)
  144. How can I make a spline out of three points that define circular arc?
  145. Inline-Building a World (SRT) Matrix (maybe)
  146. Determine if Plane is seen by Camera
  147. Understanding normal mapping
  148. Understanding normal mapping
  149. Affine transformation: rotate a plane parallel to another plane
  150. What is the simplest way to calculate distance in a 3D environment? (provides native formula + implementation pseudocode already; native formula would be better off as mathjax)
  151. "aim at" in 3D space algorithm
  152. How to reposition a bouncing ball after it has passed through a surface
  153. Separation of axis theorem implementation at normals
  154. How can I test whether points are within a polygon?
  155. How to calculate a direction vector for camera? (probably)
  156. Trajectory of a spinning ball
  157. Trajectory of a spinning ball
  158. How do I interpret the dot product of non-normalized vectors?
  159. How do I interpret the dot product of non-normalized vectors?
  160. How can I come up with a simple diminishing return equation?
  161. How can I come up with a simple diminishing return equation?
  162. How can I come up with a simple diminishing return equation?
  163. Formula to measure uv-mapping distortion (would benefit from align) Formula to measure uv-mapping distortion
  164. Gravity: Slow down on ground approach
  165. Percentage of object inside a moving rect
  166. Percentage of object inside a moving rect
  167. How do I calculate the distance between a point and a rotated rectangle? (real code; would benefit from being annotated with mathjax as the operation is fairly simple)
  168. Implicit Functions and extracting an isosurface
  169. Explaining vector math for a pendulum camera
  170. Converting time of day into a smooth day/night variable?
  171. Screen coordinates to isometric coordinates? (maybe)
  172. How do I generate solar systems for a 2d universe map, but still look random
  173. RPG like hit points growth algorithms help
  174. RPG like hit points growth algorithms help
  175. How can I manually construct a right-handed orthographic projection matrix? ‡ (would benefit from align, currently replicating that 4-dimensional matrix via a code block)
  176. Determining a sensible gear-like hierarchy for a series of connected objects
  177. How to use "weighted average easing" correctly with variable framerate?
  178. How do I convert from the global coordinate space to a local space?
  179. How do I convert from the global coordinate space to a local space?
  180. How do I convert from the global coordinate space to a local space?
  181. Find point in 3D plane
  182. How can I find the tangent and normal at an interpolated point on a Catmull-Rom/Hermite spline?
  183. Predicted target location (real code, ought to be accompanied by MathJax)
  184. Using Bullet physics engine to find the moment of object contact before penetration
  185. How do I convert screen coordinates to between -1 and 1? (probably)
  186. Why do we use the Pythagorean theorem in game physics?
  187. Why isn't this physics code scaling velocities separately?
  188. How can I compare two quaternions for logical equality?
  189. How can I Intercept object with a circular motion
  190. How can I Intercept object with a circular motion
  191. How can I Intercept object with a circular motion
  192. How to achieve cavalier projection using OpenGL fixed pipeline? ‡ (matrix notation)
  193. Integration error in high velocity ‡ (unicode, array table)
  194. How do I disassemble a 3x3 transformation matrix into rotation and scaling matrices?
  195. How do I disassemble a 3x3 transformation matrix into rotation and scaling matrices? ‡ (matrix notation)
  196. How to rotate vector A around another vector B?
  197. How to rotate vector A around another vector B? (dot product in pseudocode ends up erroneously looking more like a property accessor)
  198. How to tell right from left: Finding the vector pointing towards the right side of a character?
  199. How do I check why is no output on screen? (array tables)
  200. How to find the total bounds rectangle around a list of rectagles
  201. Projecting a light onto a quad (apparent math pseudocode at the beginning is hard to understand)
  202. How can I get a direction vector from a an Euler angle? (pseudocode formula at start of answer)
  203. Intelligently move aircraft using curves
  204. 3D Camera Rotation ‡ (matrix notation)
  205. How can I get the normal vector for a plane from a set of vertices?
  206. How to create a projectile motion of a cannonball in top down view? ‡ (photo of a handwritten formula)
  207. Applying angular velocity to quaternion
  208. https://gamedev.stackexchange.com/a/149365/33287
  209. Rotating vector3 by a quaternion (and specifically this answer ‡)
  210. https://gamedev.stackexchange.com/a/98111/40264

Tags of interest

(Note: avoid overlap when searching, e.g. ideally search [matrix] -[mathematics])

  • 1
    Thanks for including 117 in there. I'll confess I rewrote part of that answer today into a different factorization just because using ^ to show an exponent in a formula doesn't read as well as a proper superscript in math markup (and risks misinterpretation as a bitwise XOR). I still prefer code for writing the actual procedure, but being able to use common math formatting could help with the prose explanations accompanying it (eg. "This method is O(n^2 log(n)) and...") – DMGregory Jun 9 '17 at 22:44
  • 7
    Fun fact, this answer is nearly at the 30,000-character limit on posts. – doppelgreener Jun 10 '17 at 20:42
  • Wow, I didn't realize there was a limit! I wonder if we should prune the duplicate links and just append a note like "Q" "A" or "Q&A" to indicate when multiple posts on the same page demonstrate the issue. – DMGregory Jun 10 '17 at 20:44
  • 1
    I've opted to use a regex to remove title slugs from the URLs, which ought to free up a lot of characters. :) – doppelgreener Jun 10 '17 at 21:33
  • 3
    @DMGregory You can do superscript and subscript without MathJax, with the <sub> and <sup> tags, respectively. MathJax may look nicer, but for something like big-O notation it seems a bit overkill. (Not that this is any reason for the site to not have MathJax; there are clearly many reasons.) – KRyan Jul 14 '17 at 12:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .