TransWikia.com

Centering a barcode into a longtable

TeX - LaTeX Asked on March 23, 2021

I try to center horizontally a barcode into my longtable, but I don’t success it.

Actually I’m trying to put the barcode juste before the (missing at the moment) page number (this page number is normally at the bottom of the page), all of that centered horizontally.

Here is what I have now :
enter image description here

And here is an MWE :

documentclass[a4paper, 11pt]{article}
 usepackage[french]{babel}
 usepackage{pifont}

usepackage{fontspec}
 usepackage{lmodern}
 usepackage{array,longtable}
  usepackage{pst-barcode}
 usepackage{auto-pst-pdf}
 usepackage{verbatim}
  fontmyfont=cmr12 at 21pt
 title{}
 usepackage{layout}
 usepackage[nomarginpar, margin=0.7in]{geometry}
 usepackage{graphicx}

pagestyle{plain}

newcommand{newPart}[1]{
part*{#1}
markright{}
phantomsection
addcontentsline{toc}{part}{#1}}


newcommand{newSection}[1]{
section*{foreignlanguage{greek}{#1}}
markright{}
phantomsection
addcontentsline{toc}{section}{foreignlanguage{greek}{#1}}}

 % pour afficher dans le "toc", des lignes en pointillées entre les chapitres des livres et leur numéro de page.
usepackage{tocloft}
renewcommand{cftsecleader}{cftdotfill{cftdotsep}}

 % suppress page number in toc for parts
cftpagenumbersoff{part}
usepackage{sectsty}sectionfont{normalfontlargeunderline}
 usepackage{polyglossia}
 usepackage{xcolor}
 definecolor{corrected}{rgb}{0.0, 0.62, 0.38}
 definecolor{error}{rgb}{0.8, 0.25, 0.33}
 definecolor{no_change}{rgb}{0, 0, 0}
 setmainlanguage{french}
 setotherlanguage{greek}
 newfontfamilygreekfont{Arial}
newcommandPheader{rule[-2ex]{0pt}{5ex}}
newsaveboxTBox
deftextoverline#1{saveboxTBox{#1}%
makebox[0pt][l]{#1}rule[1.1htTBox]{wdTBox}{0.7pt}}

usepackage{pageslts}
 usepackage{cancel}
 renewcommand{CancelColor}{color{red}}
 usepackage{fancyhdr}
makeatletter
newcommand{nospace}[1]{nofrench@punctuationtexttt{#1}french@punctuation}
makeatother
letoldtabulartabularrenewcommand{tabular}{largeselectfontoldtabular} 

usepackage[hidelinks]{hyperref}

newcounter{gospelbook}
setcounter{gospelbook}{1}
newcommand{mygospelbook}[1]
{setcounter{gospelchapter}{1}phantomsectionaddcontentsline{toc}{part}{#1}#1}

newcommand{agospelbook}[1]{addtocontents{toc}{protectnewpage}mygospelbook{#1}}

newcounter{gospelchapter}
newcommand{mygospelchapter}{phantomsectionaddcontentsline{toc}{section}{thegospelchapter}LARGEbfseriesthegospelchapterrefstepcounter{gospelchapter}}

 % for finals N
newcommand{finalN}[1]{textoverline{#1~~}}
 newcommand{finalNedit}[3]{color{#3}{textoverline{color{#2}{#1}~~} }}  


begin{document}

pagenumbering{roman}
thispagestyle{empty}clearpagesetcounter{page}{1}
newpage
%foreignlanguage{greek}{tableofcontents}
clearpagepagenumbering{arabic}setcounter{page}{1}
newgeometry{margin=0.0in}
clearpage

 setlengtharrayrulewidth{1pt}

Large
renewcommandarraystretch{1.2}
begin{longtable}{cc|l|cc}
cline{3-3}  [-1em]
multicolumn{5}{c}{mygospelbook{foreignlanguage{greek}{ευαγγελιον κατα μαθθαιον}} textbf{(nospace{1:1})} }   [-1em] 
cline{3-3} 
cline{3-3}
&  & &  &  [-0.9em]
 mygospelchapter &  & foreignlanguage{greek}{βιβλοϲ γενεϲεωϲ textoverline{ιυ} textoverline{χυ} υιου δαυειδ} & 6 &  
& 7 & foreignlanguage{greek}{υιου αβρααμ αβρααμ εγεννηϲεν τον} & 3 & textbf{2} 
& 4 & foreignlanguage{greek}{ιϲαακ ιϲαακ δε εγεννηϲεν τον ια} & 9 &  
& 9 & foreignlanguage{greek}{κωβ ιακωβ δε εγεννηϲεν τον ιουδαν} & 14 &  
& 15 & foreignlanguage{greek}{και τουϲ αδελφουϲ αυτου ιουδαϲ δε} & 2 & textbf{3} 
& 3 & foreignlanguage{greek}{εγεννηϲεν τον φαρεϲ και τον ζαρα} & 8 &  
& 9 & foreignlanguage{greek}{εκ τηϲ θαμαρ φαρεϲ δε εγεννηϲεν} & 14 &  
& 15 & foreignlanguage{greek}{τον εζρωμ εζρωμ δε εγεννηϲεν τfinalN{ο}} & 20 &  
& 21 & foreignlanguage{greek}{αραμ αραμ δε εγεννηϲεν τον αμινα} & 5 & textbf{4} 
& 5 & foreignlanguage{greek}{δαβ αμιναδαβ δε εγεννηϲεν τον} & 9 &  
& 10 & foreignlanguage{greek}{νααϲϲων νααϲϲων δε εγεννηϲfinalN{ε}} & 13 &  
& 14 & foreignlanguage{greek}{τον ϲαλμων ϲαλμων δε εγεννηϲfinalN{ε}} & 3 & textbf{5} 
& 4 & foreignlanguage{greek}{τον βοοζ εκ τηϲ ραχαβ βοοζ δε εγfinalN{ε}} & 11 &  
& 11 & foreignlanguage{greek}{νηϲεν τον ωβηδ εκ τηϲ ρουθ ωβηδ} & 17 &  
& 18 & foreignlanguage{greek}{δε εγεννηϲεν τον ειεϲϲαι ιεϲϲαι δε} & 2 & textbf{6} 
& 3 & foreignlanguage{greek}{εγεννηϲεν τον δαυειδ τον βαϲιλεα} & 7 &  
& 8 & foreignlanguage{greek}{δαυειδ δε ο βαϲιλευϲ εγεννηϲεν τfinalN{ο}} & 13 &  
& 14 & foreignlanguage{greek}{ϲολομωντα εκ τηϲ του ουριου ϲολο} & 1 & textbf{7} 
& 1 & foreignlanguage{greek}{μων δε εγεννηϲεν τον ροβοαμ} & 5 &  
& 6 & foreignlanguage{greek}{ροβοαμ δε εγεννηϲεν τον αβια αβι} & 11 &  
& 11 & foreignlanguage{greek}{α δε εγεννηϲεν τον αϲα αϲα δε εγfinalN{ε}} & 3 & textbf{8} 
& 3 & foreignlanguage{greek}{νηϲεν τον ιωϲαφατ ιωϲαφατ δε} & 7 &  
& 8 & foreignlanguage{greek}{εγεννηϲεν τον ιωραμ ιωραμ δε εγfinalN{ε}} & 13 &  
& 13 & foreignlanguage{greek}{νηϲεν τον οζειαν οζειαϲ δε εγεννη} & 3 & textbf{9} 
& 3 & foreignlanguage{greek}{ϲεν τον ιωαθαμ ιωαθαμ δε εγεννη} & 8 &  
& 8 & foreignlanguage{greek}{ϲεν τον αχαζ αχαζ δε εγεννηϲεν} & 13 &  
& 14 & foreignlanguage{greek}{τον εζεκιαν εζεκιαϲ δε εγεννηϲfinalN{ε}} & 3 & textbf{10} 
& 4 & foreignlanguage{greek}{τον μαναϲϲη μαναϲηϲ δε εγεννη} & 8 &  
& 8 & foreignlanguage{greek}{ϲεν τον αμων αμων δε εγεννηϲεν} & 13 &  
& 14 & foreignlanguage{greek}{τον ιωϲιαν ιωϲιαϲ δε εγεννηϲεν τfinalN{ο}} & 4 & textbf{11} 
[0.2em]
cline{3-3}
begin{pspicture}(0, 0in)
parbox[b][1in]{1.5in} {
centering
    psbarcode{http://ntvmr.uni-muenster.de/community/modules/papyri/?zoom=11&left=5&top=-5&site=INTF&image=20032/0/10/10/2}{}{pdf417}
}
end{pspicture}

newpage
cline{3-3}  [-1em]
multicolumn{5}{c}{foreignlanguage{greek}{ευαγγελιον κατα μαθθαιον} textbf{(nospace{1:11})} }   [-1em] % Si on veut ajouter les bordures latérales, remplacer {7}{c} par {7}{|c|}
cline{3-3} 
cline{3-3}
 & &  &  &  [-0.9em]
& 5 & foreignlanguage{greek}{ιεχονιαν και τουϲ αδελφουϲ αυτου} & 9 &  
& 10 & foreignlanguage{greek}{επι τηϲ μετοικεϲιαϲ βαβυλωνοϲ} & 13 &  
textbf{12} &  & foreignlanguage{greek}{μετα δε την μετοικεϲιαν βαβυλωνοϲ} & 5 & 
& 6 & foreignlanguage{greek}{ιεχονιαϲ εγεννηϲεν τον ϲαλαθιηλ} & 9 &  
& 10 & foreignlanguage{greek}{ϲαλαθιηλ δε εγεννηϲεν τον ζορο} & 14 &  
& 14 & foreignlanguage{greek}{βαβελ ζοροβαβελ δε εγεννηϲεν} & 3 & textbf{13} 
& 4 & foreignlanguage{greek}{τον αβιουδ αβιουδ δε εγεννηϲεν} & 8 &  
& 9 & foreignlanguage{greek}{τον ελιακιμ ελιακιμ δε εγεννη} & 13 &  
& 13 & foreignlanguage{greek}{ϲεν τον αζωρ αζωρ δε εγεννηϲfinalN{ε}} & 3 & textbf{14} 
& 4 & foreignlanguage{greek}{τον ϲαδδωκ ϲαδδωκ δε εγεννηϲfinalN{ε}} & 8 &  
& 9 & foreignlanguage{greek}{τον αχειν αχειν δε εγεννηϲεν} & 13 &  
& 14 & foreignlanguage{greek}{τον ελιουδ ελιουδ δε εγεννηϲεν} & 3 & textbf{15} 
& 4 & foreignlanguage{greek}{τον ελεαζαρ ελεαζαρ δε εγεννηϲfinalN{ε}} & 8 &  
& 9 & foreignlanguage{greek}{τον ματθαν ματθαν δε εγεννη} & 13 &  
& 13 & foreignlanguage{greek}{ϲεν τον ιακωβ ιακωβ δε εγεννη} & 3 & textbf{16} 
& 3 & foreignlanguage{greek}{ϲεν τον ιωϲηφ τον ανδρα μαριαϲ} & 8 &  
& 9 & foreignlanguage{greek}{εξ ηϲ εγεννηθη textoverline{ιϲ} ο λεγομενοϲ textoverline{χϲ}} & 15 &  
textbf{17} &  & foreignlanguage{greek}{παϲαι ουν αι γενεαι απο αβρααμ ε} & 7 & 
& 7 & foreignlanguage{greek}{ωϲ δαυειδ γενεαι δεκατεϲϲαρεϲ} & 10 &  
& 11 & foreignlanguage{greek}{και απο δαυειδ εωϲ τηϲ μετοικε} & 16 &  
& 16 & foreignlanguage{greek}{ϲιαϲ βαβυλωνοϲ γενεαι textoverline{ιδ}} & 19 &  
& 20 & foreignlanguage{greek}{και απο τηϲ μετοικεϲιαϲ βαβυλω} & 24 &  
& 24 & foreignlanguage{greek}{νοϲ εωϲ του textoverline{χυ} γενεαι textoverline{ιδ}} & 29 &  
textbf{18} &  & foreignlanguage{greek}{του δε textoverline{ιυ} η γενεϲειϲ ουτωϲ ην} & 7 & 
& 8 & foreignlanguage{greek}{μνηϲτευθειϲηϲ γαρ τηϲ μητροϲ αυ} & 12 &  
& 12 & foreignlanguage{greek}{του μαριαϲ τω ιωϲηφ πριν η ϲυνελ} & 18 &  
& 18 & foreignlanguage{greek}{θειν αυτουϲ ευρεθη εν γαϲτρι εχου} & 23 &  
& 23 & foreignlanguage{greek}{ϲα εκ textoverline{πνϲ} αγιου} & 26 &  
textbf{19} &  & foreignlanguage{greek}{ιωϲηφ δε ο ανηρ αυτηϲ δικαιοϲ ων} & 7 & 
& 8 & foreignlanguage{greek}{και μη θελων αυτην παραδιγματιϲαι} & 12 &  
[0.2em]
cline{3-3}
end{longtable}

end{document}

One Answer

You want to center the barcode in the middle column, I presume.

Then you need to measure it, because the barcode is typeset as an object with zero width and height. Then you need to remove the rule on the left and on the right, which can be done with multicolumn.

cline{3-3}
&multicolumn{1}{l}{}&multicolumn{1}{c}{%
  makebox[5.5cm][l]{% the width is about 5.5cm
  rule{0pt}{2cm}% the height is about 2cm
  psbarcode{http://ntvmr.uni-muenster.de/community/modules/papyri/?zoom=11&left=5&top=-5&site=INTF&image=20032/0/10/10/2}{}{pdf417}%
}}

newpage
cline{3-3}  [-1em]

enter image description here

Correct answer by egreg on March 23, 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