# How can I add annotations at the end of each line of a listing? [closed]

(I'm new to LaTeX.)

I'd like to annotate each line of a (Java) listing (typeset with listings) to specify the computation time associated with it.

However, I can't simply edit the file and add the annotations in the code itself, because those annotations contain special characters that get my IDE really upset.

Therefore, I have to add those annotations in LaTeX, somehow. Hence my question: how can I add a comment at the end of a line in a listing?

## closed as unclear what you're asking by jub0bs, user13907, Masroor, ChrisS, user31729 Aug 9 '14 at 10:20

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. What you're asking for can be done if you use an lstlisting algorithm. However, that might be dfficult/impossible if you're inserting code that resides in an external file (using \lstinputlisting). – jub0bs Jul 31 '14 at 15:16
• – jub0bs Aug 1 '14 at 13:08