NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
The solution is simple. However, I have some suggestions regarding your code in general, too. I am going to list them all and include them in an example code.
The main document font should be chosen in the preamble with \setmainfont{font name} rather than using \fontspec
if you do that and leave the sf in the caption setup out you should get the same font in the captions as well.
Instead of manually putting the figure in the margin you could use the wrapfig package to define a {marginfigure} environment that would give a cleaner semantic markup in your text. You could then also use \caption directly.
Do not use " for citations but ``citet text'' to get real opening and closing quotation marks. Better yet: use csquotes as this will give you quotations marks suiting to the typographic conventions of the chosen document language (French in your case).
I'd use \label and \ref to refer to the figure.
Don't put your whole document in a {flushleft} environment. Rather set \raggedright at the beginning or \RaggedRight from the ragged2e package for a ragged body that also allows hyphenation.
I'd also set the captions raggedright when used in the margin. It will avoid lots of bad boxes and give (IMHO) a nicer result optically.
All in all I get the expression you might like the tufte-book document class. It uses a ragged text body and provides an environment for margin figures.
I have used a different font in the example below since I don't have Calibri installed (It is a Microsoft font if I know correctly?)
Your advice is totally great and helps me a lot to correct mistakes and reorganize the whole codes.
I'll read other recommended packages later.
Since the paper (around 200 pages) has lots of footnotes at margins plus images at the main body or margins, is the tufte-book document class better than others? Frankly, I have no idea about this issue.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p