TransWikia.com

Change the word “Table” in only one table caption

TeX - LaTeX Asked by user2535338 on August 8, 2021

I’m using the xltabular with the group, because of the table is large and it occupies more than one page.
My document which is a thesis, I have two types of tables, the tables and the frames.
By default the xltabular is showing frame as a table, but is a frame. There is a way to change just this table to frame?
I’ve used captionsetup[table]{name=frame}
but it changes all the other tables captions.
enter image description here
And this new table name # is showing for all tables, which are real tables and not frames.
the code is :

begingroup
footnotesize
setlengthtabcolsep{3pt}
setcellgapes{3pt}
makegapedcells
begin{xltabular}{linewidth}{| *{5}{L|}}
    captionsetup[table]{name=frame}
     caption{Long table caption.}
     label{long}
    Xhline{1pt}
multicolumn{5}{|c|}{begin frame}
    hline
textbf{Chave} & textbf{a}   & textbf{b} & textbf{c} & textbf{d}
    Xhline{0.5pt}
endfirsthead
    caption[]{Continuation}    
    Xhline{1pt}
textbf{Chave} & textbf{a}   & textbf{b} & textbf{c} & textbf{d}
    hline
endhead
    Xhline{1pt}
endfoot
     hline
     multicolumn{5}{|c|}{end frame}
     Xhline{1pt}
endlastfoot
...
...
...
end{xltabular}
endgroup

Anyone can help-me ?
Thanks a lot guys

Edited: runable code
I´ve changed the code according to the suggestion bellow and its not splitting the table to different pages and furthermore it is letting a very big empty space before the table.

documentclass{article}
usepackage{tabularray}
usepackage{lipsum}  
usepackage[paperwidth=8cm,paperheight=6cm,width=7cm,height=4.5cm]{geometry}
begin{document}

DefTblrTemplate{caption-tag}{myframe}{
  Framehspace{0.25em}thetable
}
DefTblrTemplate{firsthead}{myframe}{
  UseTblrTemplate{caption}{default}
  vspace{0.5em}
  hrule height 1pt
  vspace{0.5em}
  centerline{begin frame}
}
DefTblrTemplate{lastfoot}{myframe}{
  centerline{end frame}
  vspace{0.5em}
  hrule height 1pt
}
NewTblrTheme{myframe}{
 SetTblrTemplate{caption-tag}{myframe} 
 SetTblrTemplate{firsthead}{myframe}
 SetTblrTemplate{lastfoot}{myframe}
}

begin{longtblr}[
  caption = {Long frame caption},
  label = {longframe},
  theme = myframe,
]{
  colspec={*{5}{X}}, colsep = 3pt, rowhead = 1,
  cells = {font=footnotesize}, row{1} = {font=footnotesizebfseries},
}
hline[1pt]
  Chave   & a     &  b     & c     & d     
hline[0.7pt]
  lipsum[2-4]   & lipsum[2-4]  & lipsum[2-4]  & lipsum[2-4]  & lipsum[2-4]  
hline
  lipsum[2-4] & lipsum[2-4]  & lipsum[2-4]    & lipsum[2-4]  & lipsum[2-4]    
hline
  lipsum[2-4]    & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] 
hline
  lipsum[2-4]   & lipsum[2-4]  & lipsum[2-4]  & lipsum[2-4]  & lipsum[2-4]  
hline
  lipsum[2-4] & lipsum[2-4]  & lipsum[2-4]    & lipsum[2-4]  & lipsum[2-4]    
hline
  lipsum[2-4]    & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] 
hline[1pt]
end{longtblr}

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text

begin{longtblr}[
  caption = {Long table caption},
  label = {longtable},
]{
  colspec={*{5}{X}}, colsep = 3pt, rowhead = 1,
  cells = {font=footnotesize}, row{1} = {font=footnotesizebfseries},
}
hline[1pt]
  Chave   & a     &  b     & c     & d     
hline[0.7pt]
  lipsum[2-4]   & lipsum[2-4]  & lipsum[2-4]  & lipsum[2-4]  & lipsum[2-4]  
hline
  lipsum[2-4] & lipsum[2-4]  & lipsum[2-4]    & lipsum[2-4]  & lipsum[2-4]    
hline
  lipsum[2-4]    & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] 
hline
  lipsum[2-4]   & lipsum[2-4]  & lipsum[2-4]  & lipsum[2-4]  & lipsum[2-4]  
hline
  lipsum[2-4] & lipsum[2-4]  & lipsum[2-4]    & lipsum[2-4]  & lipsum[2-4]    
hline
  lipsum[2-4]    & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] 
hline[1pt]
end{longtblr}
end{document}

The output is the following:
too many blank pages before the table/frame, the table/frame are cut off , and too many blank pages after the table/frame that were cut.

Thank again you all guys
enter image description here

One Answer

If you would like to give the new LaTeX3 package tabularray a try, then it is easy to customize table captions.

documentclass{article}
usepackage[a4paper,left=1cm,right=1cm,top=1.5cm,bottom=1.5cm]{geometry}
usepackage{tabularray}
usepackage{lipsum}
begin{document}

DefTblrTemplate{caption-tag}{myframe}{
  Framehspace{0.25em}thetable
}
DefTblrTemplate{firsthead}{myframe}{
  UseTblrTemplate{caption}{default}
  vspace{0.5em}
  hrule height 1pt
  vspace{0.5em}
  centerline{begin frame}
}
DefTblrTemplate{lastfoot}{myframe}{
  centerline{end frame}
  vspace{0.5em}
  hrule height 1pt
}
NewTblrTheme{myframe}{
 SetTblrTemplate{caption-tag}{myframe} 
 SetTblrTemplate{firsthead}{myframe}
 SetTblrTemplate{lastfoot}{myframe}
}

begin{longtblr}[
  caption = {Long frame caption},
  label = {longframe},
  theme = myframe,
]{
  colspec={|*{5}{X|}}, colsep = 3pt, rowhead = 1,
  cells = {font=footnotesize}, row{1} = {font=footnotesizebfseries},
}
hline[1pt]
  Chave   & a     &  b     & c     & d     
hline[0.7pt]
  lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] 
hline
  lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] 
hline
  lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] 
hline
  lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] 
hline
  lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] 
hline
  lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] 
hline[1pt]
end{longtblr}

lipsum[1-10]

begin{longtblr}[
  caption = {Long table caption},
  label = {longtable},
]{
  colspec={*{5}{X}}, colsep = 3pt, rowhead = 1,
  cells = {font=footnotesize}, row{1} = {font=footnotesizebfseries},
}
hline[1pt]
  Chave   & a     &  b     & c     & d     
hline[0.7pt]
  lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] 
hline
  lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] 
hline
  lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] 
hline
  lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] 
hline
  lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] 
hline
  lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] & lipsum[2-4] 
hline[1pt]
end{longtblr}
end{document}

Answered by L.J.R. on August 8, 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