TeX - LaTeX Asked by DPD- on January 14, 2021
I need to put a tabular into a long table and assign a caption and a label to the "sub tabular". I tried putting the nested tabular into a table environment but it doesn’t work:
documentclass{article}
usepackage{longtable}
begin{document}
begin{longtable}{c}
begin{table}
begin{tabular}{c}
test
end{tabular}
caption{my caption}
label{tab:mysubtable}
end{table}
end{longtable}
end{document}
I tried also to wrap the table environment in a minipage and to do without the table evironment, simulating the caption with captionof{table}{my caption}
but both attempts failed.
I tried also using xltabular
instead of longtable, but it didn’t solve.
UPDATE
As @leandriis was pointing out I insert the motivation: I need to create a table of steps to solve a problem: each row contains the information related to a specific set of steps to solve the problem and in one column I have to put all the steps of the set. Since some set of steps can be reused in another set it’s important to label the set of steps and to refer it. A simplified example:
start | steps | end |
---|---|---|
A | "subtabular with images of steps, caption and label" | B |
B | "subtabular with images of steps, caption and label" | C |
A | Apply "1", then "2" | C |
The steps must be aligned and so a tabular is what I thought of, in the caption I will write the name of the algorithm (the set of steps) and use the label to refer to it in the next rows.
I can simulate the caption and the label in this way:
documentclass{article}
usepackage{longtable, hyperref}
newcounter{alg}
newcommandalgcaption[1]{refstepcounter{alg}textbf{Algorithm thealg:} #1}
begin{document}
begin{longtable}{c}
begin{tabular}{c}
begin{tabular}{cc}
test1 & test2
end{tabular}
algcaption{mycaptionlabel{alg:mylabel}}
end{tabular}
See~ref{alg:mylabel}
end{longtable}
end{document}
Correct answer by DPD- on January 14, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP