0
 \lstinputlisting[
   numbers=left,
   breaklines=true,
   caption={Kalukasjon av esker},
   label={list:LuaKalk},
   language={[5.0]Lua} ,
   firstline=139, 
   lastline=168]
   {code/Main.lua}


 \ref{LuaKalk}

Can't seem to be able to refer this listing, figures and cite works fine. Suggestions? Writing on my bachelor's paper over at OverLeaf

  • (1) welcome, (2) as always on this site, you are much much more likely to get fast help if you provide a full but minimal example showing your problem. Then others can just copy this an start debugging immediately. Here we need to guess 3/4 of the document. BTW: what does this code has to do with tcpinputlisting, this seems to be just listings – daleif Apr 20 '18 at 11:58
  • 1
    Seems to me that you need to use \ref{list:LuaKalk}. – Tiuri Apr 20 '18 at 12:00
  • @daleif i did consider posting the whole main.tex but tought it would contain mostly Irreverent information. – Melvin Langvik Apr 20 '18 at 13:24
  • Not the whole doc, a minimal one, only using what ever is relevant to show this problem. Preparing such a minimal document (basically you make a copy somewhere else, and start removing stuff), is a vital tool in learning to debug LaTeX. People have a tendency to steer away from examples that are 1000s of lines long – daleif Apr 20 '18 at 13:30
1

This is just a normal user error, the label is list:LuaKalk but you refer to \ref{LuaKalk} which should have been \ref{list:LuaKalk}

  • Worked, i tried this earlier but stopped before acutally refreshing the preview, as the auto-completion-suggestion bar didn't show this as an option. Thanks! – Melvin Langvik Apr 20 '18 at 13:23
  • @MelvinLangvik The auto completion probably looks for explicit \label{key}, but here this is hidden in the belly of listings – daleif Apr 20 '18 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.