
Show HN: TeXnique – A LaTeX Typesetting Game - fortenforge
https://texnique.xyz
======
barbierocks
One of the developers here! Right now, we compare answers visually, so for
example `n \choose k` and `\binom{n}{k}` will both be accepted. However,
sometimes there are things that look similar to the human eye, but are
rendered slightly differently -- this is usually due to alignment, spacing, or
size. For example, `\not\in` (bad) vs `\notin` (good) is a pretty annoying
example. Making the comparison / feedback mechanism better is a tough problem.
It isn't as simple as increasing the pixel threshold: replacing a + with a -
has an extremely small pixel difference (and the two characters have the same
width, so it doesn't affect anything else), but we shouldn't accept both.

Right now, the website is a super simple static HTML page. If we have time,
we'd also like to add some new features, like a leaderboard and (hopefully)
better comparison logic. Feel free to contribute, and we appreciate the
feedback!

~~~
kmill
Nice idea for a game -- I use LaTeX quite a lot so it was fun testing that I
could type everything. One small LaTeXing speed trick I was using is to drop
curly braces for single-letter arguments, like

    
    
       \frac 1 n
    

instead of

    
    
       \frac{1}{n}
    

though even greater gains would be from having your own bespoke file-of-
macros.

I feel like the game doesn't give enough time with respect to how long it
takes to type certain expressions, so you'll get some high variance on scores
just from this cutoff. If you get a big expression right at the end of the
time limit, there's a chance you'll lose out on 11 points because it took a
second to recognize what you typed --- I played three times, getting around 53
and 55 points the first two times, but then the third time I only got 42
because it didn't recognize the following expression:

    
    
       W(x,p)=\frac{1}{\pi \hbar}\int_{-\infty}^\infty\langle x+y|\hat\rho|x-y\rangle^{-2ipy/\hbar}dy
    

and I couldn't spot the difference in the few seconds I had left.

For some of the equations, I was tempted to fix the typesetting, but I figured
if I did it wouldn't recognize it. For example, there needs to be a hairline
space in integrals:

    
    
       \int u\,dv
    

Or for divisibility it should use \mid for the relation and not |.

A small frustration was the delay between typing an expression, recognition,
then rendering the new expression, especially since this all counted toward
the time limit. Maybe having MathJax pre-render the expressions could speed
some of this up. Another option is instead of a trial of how many you can
complete is having a small collection then timing how long it takes to
complete that. Instead of having a sequence of expressions with different
numbers of points, the page of expressions could all be of a similar level of
difficulty.

~~~
barbierocks
Thanks for the feedback! In fact, you can even do stuff like $\binom nk$ or
$\frac 1n$, you don't need the space.

~~~
kmill
(Sometimes when I'm particularly lazy, I've gone as far as \frac1n. Though
usually I consider spaces to be cost-free.)

------
olooney
Couple of pieces of feedback:

1\. There's an order of magnitude difference in the difficulty of problems.
Some are hardly more complex than a couple of subscripts and maybe a
\frac{}{}, while others need matrix notation. However, they all count as "1
problem." That's pretty weird.

2\. There were also a couple of problems where I couldn't figure out why it
wasn't accepting my answer, as it was visually identical. It must already be
allowing for several variations (\text vs. \operatorname, \over vs. \frac),
but Latex is so flexible it doesn't seem to be able to catch all the
equivalent ways to solve problems. Plus, there's absolutely no feedback, which
means you can sink 30 seconds into a hard problem, not have it accept it, and
have no idea what to do next.

~~~
barbierocks
1\. That's why we added a point system, but I agree the variation in
difficulty is pretty wild.

2\. See my comment above - comparison is a tough problem right now, the
website is pretty simple. We'd like to improve it though!

~~~
olooney
I think it's a great start - I'm a big fan of typing games like TyperA, and
one of the things I enjoy most about blogging or answering questions on
stats.stackoverflow.com is formatting mathematical in beautiful LaTex. It just
needs to be just a little bit more polished overall to be a really compelling
experience.

------
godelski
LOVE THIS!

But I have a few suggestions.

1) have a variable time. 3 minutes is pretty tough (maybe 5 default?)
Sometimes I can get 10, sometimes I can get 1. I know there's the skip, but
this is more fun for learning than competing tbh (can't seem to quite get to
40. Maybe a few more goes). (I can hack this like another comment says with
console lol)

2) do a recap! Including the ones you skip. That way when you skip you don't
feel like you lose out on the learning. It's "I can't remember this, I'll get
it next game" kinda thing. It would also be great to see the different
possible solutions.

3) there's some cases I can't quite see what's wrong with. There's a few I
spent the entire time looking for the difference. Anyone else hit this issue?
Most of them were pretty simple too so I wouldn't have expected them to be
written in a different way, especially since all parts of my solutions were in
other problems that I got right. Maybe also have a "I got this right" button
and you the devs can get new methods? (I wouldn't auto store these, but maybe
give the points and manually check later. If you're interested in maintaining
and continuing this project)

4) some help with formatting would be awesome. I'm writing the messiest latex
of my life here simple because I can't use a tab.

But all in all I love this. Already sent to a bunch of friends and I'm going
to have students use this.

Edit:

5) maybe make the total points in a game similar. My highest score I got a
really large problem and then a small problem. Other runs in going very fast
and don't even score 30 because they are all low points.

Edit 2:

Some of these that are low points are really time consuming. Getting to 40
seems like a luck based thing

~~~
barbierocks
Thanks for all the feedback!

1\. Hmm, perhaps we could change the game model? Instead of solving as many as
you can in three minutes, we could (1) have a set time per problem, and a
fixed number of problems or (2) have some system to add back time for correct
answers.

2\. This is on our todo list!

3\. Yes, see my comment from above -- we're thinking of simple ways to accept
slight variations. A way to contest variations might is a good idea.

4\. How do you propose we do this?

5\. So right now, a problem is worth ceiling(length of our solution / 10.0)
points. This seemed like a good way to reward harder questions proportional to
the time spent solving them. Any other suggestions?

------
mmcclimon
This was much more fun after I entered `secondsRemaining = 100000` in the
console.

------
no_protocol
I was able to complete one problem within the 3 minute time limit. I had to
try multiple times to get the right code for two of the symbols required. The
linked symbol drawing site would have helped on one of them.

I really like the format of the user interface with instant response/feedback.

It seems like you're pretty close to having an genuinely useful page.

Suggestions:

\- As-is, this is really only useful to people who already have some
familiarity with this material already. It would be way more useful if it had
an additional mode for an absolute beginner

\- Instead of being just a memory/recall test, the primary usage mode should
be a tutorial and response format for learning

\- In the learning mode, first present information on one new concept, then
allow the user to test their new knowledge on a problem similar to the way the
existing system works

~~~
barbierocks
Tutorial mode is a great idea! Yeah, this is definitely geared towards
experienced people.

~~~
moraljto
+1! a tutorial mode would be really helpful. Especially if it included a
"reveal (one possible) answer" functionality.

------
cos2pi
I had a lot of fun with this.

I surprised myself by remembering some symbols I haven't used in a while but
was stumped on a few I should have known (nth roots).

Thankfully typesetting here meant math formulas, not minipage layouts.

------
acgan
This was really fun! Here are some thoughts:

Most researchers / students I know who are "power-users" of TeX have fairly
idiosyncratic editing habits, so it would be nice to support `\newcommands` or
eventually editor bindings. (I write a lot of "live-TeX" during lectures for
school: [https://github.com/acganesh/stanford-
compendium](https://github.com/acganesh/stanford-compendium), and I have one-
character `vim` macros for each symbol). I ended up opening a `vim` pane and
copying my TeX over to Chrome.

I know Evan Chen (MIT grad student) is a really prolific live-TeXer, so you
might try contacting him for feedback. I'm a huge fan of this project of his:
[https://github.com/vEnhance/napkin](https://github.com/vEnhance/napkin).

I really like the visual equation recognition, sort of like a beefed up
DeTeXify. It's very helpful to ensure that all "equivalent" TeX commands are
matched appropriately.

I think there are some gotchas with space matching (I opened a few GitHub
issues, e.g.
[https://github.com/akshayravikumar/TeXnique/issues/7](https://github.com/akshayravikumar/TeXnique/issues/7)),
but these should be fixable.

Feel free to contact me if I can help! Sounds like a really fun project.

~~~
barbierocks
Supporting custom macros seems hard, but we should be able to fix spacing
problems if we revamp the comparison logic entirely. Thanks for filing the
Github issues -- we definitely welcome any contributions, so let us know if
you have any ideas!

Also, we're friends with Evan and have already gotten his feedback. :)

------
Darmani
For irrationality of root 2, I typed.

    
    
        \sqrt{2}\not\in\mathbb{Q}
    
    

It refused to accept this answer, even though it looked pixel-for-pixel
identical with the intended output.

On further play...perhaps there's some small difference between \not\in and
\notin, as there is clearly between \not\exists and \nexists, but I couldn't
see it..

Similarly, for the inverse of a complex number, I couldn't figure out why it
didn't accept:

    
    
         z^{-1} = \frac{\overline{z}}{|z|^2},\forall z \neq 0

~~~
no_protocol
Probably was supposed to be \notin rather than \not\in? They are not pixel for
pixel identical.

~~~
barbierocks
Yeah, the comparison logic is pretty simple right now (see my comment).
Unfortunately, `\not\in` and `\notin` look slightly different.

We're figuring out the best way to accept slight variations. It's a tough
problem and isn't as simple as increasing the pixel threshold. For example,
replacing a + with a - has an extremely small pixel difference (and the two
characters have the same width, so it doesn't affect anything else), but we
shouldn't accept both.

~~~
Darmani
How about the complex number inverse one?

~~~
godbyk
Perhaps \bar{z} instead of \overline{z}?

------
grandpa
This is really good fun! But it would be nice if I could finish up the problem
I'm on when the timer runs out. Currently, it just gets taken away abruptly.

~~~
vngzs
Yeah, it should let you finish the problem and alternatively show the answer
once you're done.

------
simo2
Hey, wow! This is such a fun game! Thank you so much. How about we make a
highscore for some tricky feats?

Finally something to let my TeX mind out at.

A problem is though, that at times the game will surprisingly quit saying I've
run out of time? Don't know what is going wrong here.

~~~
barbierocks
Weird...before the 3-minute limit? Maybe there's a bug somewhere with the
timer.

~~~
simo2
It happens after succesfully finishing several rounds.

------
cozzyd
Maybe it would be more fun if you got back some time proportional to the
number of points for a problem (maybe twice the number of points?). Otherwise
I'm going to skip the matrix stuff since it takes way too long to type (for
me).

~~~
barbierocks
Hmm that might be a good idea! The point system is supposed to normalize
difficulty, but I understand people might skip the egregiously long ones
anyways.

------
ecesena
This is awesome! You should accept submissions from the crowd... and
eventually summarize good guidelines. In addition to the not you mentioned, I
get particularly itchy when I see bad spacing and/or incorrect punctuation.
Thank you for your service to the community!

------
aznpwnzor
I love this game. My first week of Classical Mechanics and QM, I dove right in
and decided to take notes live in LaTeX.

Obviously I knew the basics, but boy does immersion work in learning a
language.

I highly recommend it for anybody who wants to climb the curve.

------
gerbilly
I entered my answers in plain TeX and they worked.

I'm either rusty, or the time limits aren't reasonable.

I barely made it through the big equation with the partials in it (sorry
forgot the name).

------
alanbernstein
This is a neat game. I wonder if it could also function as a teaching aid, if
you provided hints, at the cost of points, as the timer runs up for a single
problem.

------
jholman
Wow, nice. 15 years after giving up on learning TeX, I just wrote my first
successful (La)TeX formula, in only 2 minutes and 47 seconds! Sweet!

------
ReedJessen
I got zero. Zero formulae typed in 3 minutes.

------
keymone
i solved the problem in time and got 0 points. not trying again i guess?

