Graphics, Figures & TablesHow to make function that can recieve some parameters

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
mnajib
Posts: 6
Joined: Sat Sep 27, 2014 6:59 pm

How to make function that can recieve some parameters

Post by mnajib »

Code: Select all


\begin{figure}
        \centering
        \includegraphics[width=.7\textwidth]{example-image-a}
        \doubleCaptionAndLabel{label-for-ref}[text in list entry][english language caption][malay language caption] % with full input
\end{figure}
nanana nanana \ref{label-for-ref} nanana\par

\begin{figure}
        \centering
        \includegraphics[width=.7\textwidth]{example-image-b}
	\doubleCaptionAndLabel{fig-bola}[][][] % with minimum input
\end{figure}
lala lalala \ref{fig-bola} lalala\par

Hi
I am looking for a draff function of the \doubleCaptionAndLabel.
Maybe using something like \NewDocumentCommand from package xparse, I'm not sure, still studying. Need the draff so I can understand how it works, at the same time refering maybe at http://ossm.utm.my/tex-archive/macros/l ... aption.pdf and http://ossm.utm.my/tex-archive/macros/l ... xparse.pdf
Thank you.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

How to make function that can recieve some parameters

Post by Johannes_B »

Hi,

as mentioned earlier, package ccaption is not the way to go. Package bicaption is much more advanced.

But to the point, i don't understand what you are asking for right now. Can you elaborate on what you mean by a draff function?

Which parameters do you want to pass to achieve what result?

This seems to be some kind of follow-up on How to make dual language caption. Is it related?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
mnajib
Posts: 6
Joined: Sat Sep 27, 2014 6:59 pm

How to make function that can recieve some parameters

Post by mnajib »

as mentioned earlier, package ccaption is not the way to go. Package bicaption is much more advanced.
Thanks, I am overlook about above statement.

Actually for this question, I am just trying to understand how to make a function, from given function call;

Code: Select all

\functionName{requiredParameter1}[optionalParameter2]
So the question How to make dual language caption should not related, just for an example.

I am preaty sure, this kind of question have been asked and answered here \newcommand and optional parameters , sorry for repeat question.
Post Reply