4
\$\begingroup\$

I recently posted a question that is meant to have the following block of display-style MathJax at the top.

$$
\begin{align}
   \text{maximize} \quad & f(x) = \sum_{i=1}^n u_i x_i \\
 \text{subject to} \quad & \sum_{i=1}^n w_i x_i \leq W \\
                         & 0 \leq x_i \leq 1, ~~ i = 1 \dots n
\end{align}
$$

However, attempting to post this gives me the following error:

Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the code toolbar button or the CTRL+K keyboard shortcut. For more editing help, click the [?] toolbar icon.

I worked around this by posting the MathJax above as-is in a code block. A user with more privileges than me kindly saw what I was trying to do and edited it to read (note the indentation)

$$
    \begin{align}
       \text{maximize} \quad & f(x) = \sum_{i=1}^n u_i x_i \\
     \text{subject to} \quad & \sum_{i=1}^n w_i x_i \leq W \\
                             & 0 \leq x_i \leq 1, ~~ i = 1 \dots n
    \end{align}
$$

which renders correctly.

However, I recently tried to a small change to my question, and found that my edit wouldn't go through because of the very same "Your post appears to contain code that is not properly formatted as code" error. I had to change the MathJax back to a code block to make my edit, again in the hopes that someone with higher rep will come along to fix it.

Needless to say, this is a nuisance for whoever has to clean up after me. It also discourages new users from improving their posts through edits, and harms the legibility of posts from users who cannot get MathJax to work correctly.

\$\endgroup\$
2

0

You must log in to answer this question.

Browse other questions tagged .