I would like to be able to give inline equations using $…$ a label such that I can refer to it later in my thesis.
My goal in pseudocode:
Some text $mc^2(eqn number)\label{some eqn}$ some more text
And than be able to use
some text \ref{some eqn} some more text
Obviously the above does not work but I hope it gets along what I am hoping to achieve.
I will also sketch the reason for this inquiry because I am definitely open for other solutions than my idea above.
I frequently come across small formula that are not really worth a full:
\begin{equation}...\end{equation}
or
\begin{align} ... \end{align}
and are better mentioned in line. The problem is that it also happens that I need to refer to these small formula later in the work.
Best Answer
In case my
\marginpar
idea is ok for you, this would allow it:To avoid confusion, perhaps you shouldn't use a custom counter but the equation counter. For this change the above contents of
%CODEBLOCK
to:EDIT: For the alignment of the other equationlabels, try (it works for
align
of theamsmath
-package, but I didn't test any others):On the other issue: You might also put the label next to the equation, like in Werner's answer. Other than that I have no idea at the moment.
EDIT2: I just noticed, that
\marginnote
places two notes invoked on the same line above each other. Because of this I changed the command\inlinelabel
:Now you can call the
\inlinelabel
with an optional argument which is the number of prior equations in that line. The result looks like this:And this is the content of
\begin{document}...\end{document}
in the above image:EDIT3: I've changed the function again (now the commas in the marginnotes are only printed once not multiple times). The new complete MWE shows some limitations of this code.