So I'm supposed to make a command that manually applies label to a picture, using hypertarget and a counter, and then adds the one to list of figures. Note that the pictures I'm manipulating with, have to be included outside of figure environment, but rather in minipage. I've tried to manually put everything together, but it looks dull and not as the tex generates the list of contents. Here is the snippet of the code, any help is appreciated.









    \addcontentsline{lof}{section}{\arabic{x} \hspace{4mm} #1}

    \hypertarget{labela\arabic{x}}{Slika \arabic{x}.{#1}}










I hope it's not an issue that some of the words in there are not in english, it's just the names of the variables so to say anyway.


  • 2
    Why don't you just use \captionof{figure}{...} from the caption or capt-of packages? – John Kormylo Apr 4 at 18:04
  • BTW, Inside the minipage \textwidth changes to the minipage width. I suspect that what you really want is vspace*{\baselineskip}. or \null\newline. – John Kormylo Apr 4 at 18:08
  • Well, my assignment is to kinda make it work manually, without floating elements, captions, figures, etc. I'm still familiarizing myself with LaTeX so it might be the only way to make this work, but if you have any idea I would appreciate – Zlatan Radovanovic Apr 5 at 20:48
  • See tex.stackexchange.com/questions/372768/… although this only works for single line captions. The single line check puts the caption into a savebox and compares the width to \columnwidth, then uses either a \makebox or \parbox for the caption. – John Kormylo Apr 7 at 16:42

Your Answer

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

Browse other questions tagged or ask your own question.