TransWikia.com

Unexpected multiple spaces instead of one in figure caption

TeX - LaTeX Asked on December 13, 2021

I am facing an issue with image caption when I tried to add a source to it. I don’t want the source to show in listoffigures. The way I found to achieve it, is by adding command

newcommand*{captionsource}[2]{%
  caption[{#1}]{%
    #1%
    \hspace{linewidth}%
    {Źródło:} #2%
  }%
}

and then in my file, I use it as follow

begin{figure}[h]
centering
includegraphics[scale=0.65]{arduino}
captionsource{Opis wejść oraz wyjść Arduino Nano 33 BLE}{url{https://content.arduino.cc/assets/Pinout-NANOble_latest.pdf}}
label{fig:arduino}
end{figure}

But instead of expected

Figure 1: Caption (This works as it should)
Source: My_Url (Here I Want one space between the colon and my URL, which doesn't work)

I either get no spaces in source if I’ll remove the single space from the command captionsource in line {Źródło:} #2%, and the link is glued to the colon (Source:My_Url) or single space results in this:

enter image description here

It’s my first paper in Latex, I hope you can help me since I can’t find the solution by myself.

One Answer

your url has not enough breakpoints. You can try the xurl package which allows it to break in more places, or set the caption in ragged right (how depends on your class and your packages).

Answered by Ulrike Fischer on December 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP