I need to reproduce a custom WYSIWG template that has:
- Table in the Footer,
- Tables in the Left margin (with text in 0 and 90 degrees orientations),
- Disclaimer + vertical Rule in the Right Margin,
- Horizontal rules and Text in the Header
So, basically the body is fully framed.
All the above shall be present in all the pages. However, the cover page shall in addition have additional tables in the body area.
Attached pics are a sample of the above (items in curly brackets {variable} are variables).
I have managed to reach some level or replication (see attached pic ) in LateX by following the answers in several other posts, however, after several days of trying, without full alignment against the sample: non-uniform textwidth nor textheight nor margins, and in addition getting multiple errors during compilation.
With this code I’m having the following issues:
- Coverpage is “hardcoded”,
- Pagelayout is not uniform along the full document,
- Title block proportions are hardcoded (not a function of paperwidth, paperheight),
- Three (3 no.) unintended pages are being created:
- A blank 2nd page
- A blank 2nd last page
- The last page
- Location of elements in the coverpage depends on the text length, therefore no dentical position for all items.
I would appreciate any help to make this LaTeX code to really replicate the WYSIWYG sample, and fix the errors being thrown.
Hereto is the code (I’m using TeXstudio 4.8.0 with default PdfLaTeX compiler)
documentclass[letterpaper,12pt]{article}
usepackage{helvet}
usepackage[english]{babel}
usepackage{atbegshi}
usepackage{adjustbox}
usepackage{tabularx}
usepackage{makecell}
usepackage{array}
usepackage{fancyhdr}
usepackage{marginnote}
usepackage{rotating}
usepackage{multirow}
usepackage{lastpage}
usepackage{tikz}
usepackage{graphicx,wrapfig}
usepackage{setspace}
usepackage[document]{ragged2e}
usepackage[letterpaper, textheight=619pt, headsep=40.0pt, footskip=30pt, bindingoffset=100pt, textwidth=383pt, includemp=false, marginparsep=70.0pt, showframe=false, showcrop, includeheadfoot]{geometry}
%Original
%usepackage[letterpaper, textheight=20.35cm, headsep=60.0pt, footskip=50pt, hdivide={5cm,,}, bindingoffset=1cm, textwidth=13.5cm, includemp=false, marginparsep=70.0pt, showframe=false, showcrop, includeheadfoot]{geometry}
%
usepackage[utf8]{inputenc}
usepackage[mmddyyyy]{datetime}
usepackage{lipsum}% just to generate filler text for the example
renewcommand{familydefault}{sfdefault}
pagestyle{fancy}
%-----------------------------------------------------------------
%-----DEFINITIONS-------------------------------------------------
%-----------------------------------------------------------------
title{My first LaTeX document}
%-CLIENT INFORMATION-
newcommand{ClientProjectCode}{Project Code}
newcommand{ClientProjectName}{PROJECT NAME }
newcommand{Location}{Location Type}
newcommand{PlantName}{Location 1}
newcommand{PlantNumber}{NNN}
%-DOCUMENT INFORMATION-
newcommand{ClientDocIndex}{8}
newcommand{ClientDocType}{RT}
newcommand{ClientDocNumber}{05-wer520}
newcommand{ClientRev}{0}
newcommand{DocTitle}{REPORT ANALYSIS}
newcommand{ProjectCode}{NNNNNx}
newcommand{Unit}{NNN}
newcommand{DocCode}{5522RT}
newcommand{SerialCode}{01}
newcommand{Rev}{0}
%Fullnames
newcommand{WrittenBy}{Fulano}
newcommand{CheckedBy}{Merlano}
newcommand{ApprovedBy}{thebest}
newcommand{AuthorizeedBy}{Sultano Sultania}
newcommand{CertifiedBy}{thebest}
newcommand{ConstAgency}{Sultano Sultania}
newcommand{Operations}{Sultano}
%Initials
%Revisions
newcommand{FsRev}{vphantom{2} A}
newcommand{FsDate}{05/12/2024}
newcommand{FsDesc}{Issue for Construction}
newcommand{ScRev}{vphantom{2} B}
newcommand{ScDate}{05/12/2024}
newcommand{ScDesc}{Issue for...}
newcommand{TdRev}{vphantom{2} }
newcommand{TdDate}{05/12/2024}
newcommand{TdDesc}{Issue for...}
newcommand{FhRev}{vphantom{2} }
newcommand{FhDate}{05/12/2024}
newcommand{FhDesc}{Issue for...}
%-----------------------------------------
%-----------------------------------------
renewcommand{headrulewidth}{0pt}
fancyhead{}
fancyhead[L]{vspace{0.91cm}tiny KKKER3455 \}%2616-ENG (03/99) \}
fancyhead[C]{\hrulefill\ adjustbox{padding=0ex -2ex 0ex 1ex}{large CLIENT COMPANY \ vspace{-0.2cm} hrulefill }}
fancyheadoffset[h]{8.45mm}
fancyhfoffset[L]{15.5mm}
fancyfoot{}
fancyfoot[L]{%
%--Footer------------
reversemarginpar
marginnote{%%
%---------side rotated table 1
tiny Template code
begin{turn}{90}
tiny
begin{tabular}{ | m{2em} | m{1cm}| m{2cm} | m{3cm} | m{0.5cm} | m{0.5cm} | m{0.5cm} | m{0.5cm} | }%{|l|l|l|l|l|l|l|l|}
hline
REV NO. & adjustbox{padding=0ex 1ex 0ex 2ex}{DATE} & Job & DESCRIPTION & ENGG & CERT & PMT & adjustbox{padding=-1ex 0ex 0ex 0ex}{OPRNS}\ hline
adjustbox{padding=0ex 1.2ex 0ex 1.7ex}{FsRev} & FsDate & ClientProjectCode & FsDesc & & & & \ hline
adjustbox{padding=0ex 1.2ex 0ex 1.7ex}{ScRev} & ScDate & ClientProjectCode & ScDesc & & & & \ hline
adjustbox{padding=0ex 1.2ex 0ex 1.7ex}{TdRev} & TdDate & & & & & & \ hline
adjustbox{padding=0ex 1.2ex 0ex 1.7ex}{FhRev} & FhDate & & & & & & \ hline
end{tabular}%
end{turn}
setlength{tabcolsep}{0pt}
tiny
begin{tabularx}{2.47cm} {
| >{centeringarraybackslash}X
|}
%begin{tabular}{|p|}
hline
adjustbox{padding= 2ex 0ex 0ex 1ex}{DISCIPLINE} newline adjustbox{padding= 2ex 0ex 0ex 0.5ex}{ENGINEER} newline adjustbox{padding= 0ex 2ex 0ex 2ex}{WrittenBy} newline adjustbox{padding= 0ex 1ex 0ex 0ex}{DATE: today} \ hline
adjustbox{padding= 2ex 0ex 0ex 1ex}{PROJECT} newline adjustbox{padding= 2ex 0ex 0ex 0.5ex}{ENGINEER} newline adjustbox{padding=0ex 2ex 0ex 2ex}{WrittenBy} newline adjustbox{padding= 0ex 1ex 0ex 0ex}{DATE: today} \ hline
adjustbox{padding= 2ex 2ex 0ex 1ex}{CERTIFIED} newline adjustbox{padding= 0ex 2ex 0ex 3ex}{ConstAgency} newline adjustbox{padding= 0ex 1ex 0ex 0ex}{DATE: today} \ hline
adjustbox{padding= 2ex 0ex 0ex 1ex}{CONSTRUCTION} newline adjustbox{padding= 2ex 0ex 0ex 0.5ex}{AGENCY} newline adjustbox{padding=0ex 2ex 0ex 2ex}{WrittenBy} newline adjustbox{padding= 0ex 1ex 0ex 0ex}{DATE: today} \ hline
adjustbox{padding= 2ex 2ex 0ex 1ex}{OPERATIONS} newline adjustbox{padding= 0ex 2ex 0ex 3ex}{ConstAgency} newline adjustbox{padding= 0ex 1ex 0ex 0ex}{DATE: today} \ hline
end{tabularx}%
setlength{tabcolsep}{0pt}
%---------side rotated table 2
begin{turn}{90}
%renewcommandarraystretch{1.3}
tiny
setlengthtabcolsep{0.1cm}
begin{tabular}{ | p{3.6cm} | p{1.8cm} | }%{|l|l|l|l|l|l|l|l|}
hline
adjustbox{padding=1.2ex 1ex 0ex 1.5ex}{ textbf{scalebox{1.2}[1.5]{REVISION CERTIFICATION}}} & adjustbox{padding=0ex 0ex 0ex 0ex}{textbf{makecell{Entity \ underline{VERIFICATION}}} } \
THIS INDICATES THAT~REV.~NO.~underline{hspace{3pt}Revhspace{3pt}}
OF THIS DRAWING IS COVERED, FOR ALL APPROVAL/CERTIFICATION REQUIREMENTS, BY DRAWING COMPLETION CERTIFICATE ~NO.~underline{hspace{60pt}} & vspace{2ex} hspace{1.65cm} underline{hspace{1.65cm}} scalebox{0.8}[1.0]{CONTROL NUMBER} vspace{1ex} BY:~underline{hspace{1.2cm}} vspace{1ex} DATE:~underline{hspace{1.15cm}} \ hline
end{tabular}%
end{turn}
%--
setlength{tabcolsep}{0pt}
%--
}[-9.58in]%%
resizebox{16cm}{!}{
newline
begin{tabular}{|p{1in}rc|c|c|c|c|c|}
hline
multicolumn{2}{|l|}{DocTitle} & {scriptsize DWG. TYPE} & multicolumn{1}{c|}{scriptsize PLANT NO.} & multicolumn{1}{c|}{scriptsize TypeIdx} & scriptsize DRAWING NO. & scriptsize SHT NO. & scriptsize REV.NO. \ cline{1-2} cline{4-8}
multicolumn{2}{|l|}{ClientProjectName} & ClientDocType & multirowcell{2}{{PlantNumber}} & multirowcell{2}{{ClientDocIndex}} & multirowcell{2}{{large ClientDocNumber}} & multirowcell{3}{thepage of pageref{LastPage}} & {} \ cline{1-3}
multicolumn{3}{|l|}{Location} & multicolumn{1}{c|}{} & multicolumn{1}{c|}{} & & & largeClientRev \ cline{1-6}
PlantName & multicolumn{2}{r|}{scriptsize Country} & multicolumn{1}{r}{scriptsize Job:} & multicolumn{2}{l|}{ClientProjectCode} & & \
hline
end{tabular}
}
}
%--end of sidetable--------------
%Draws the rightside vertical line to complete the frame.
newtoksoldoutput
oldoutput=expandafter{theoutput}%
output{%
setbox255vbox to 0pt{%
hbox to 0pt{%
vsizeht255%
vbox to 8.377in{%
vss
hbox to 5.656in{%
hss
vrule height 9.37in width 0.4pt%
}%
}hss
}vss
box255%
}%
theoldoutput
}%
%-----
begin{document}
begin{tabularx}{13cm}[!H]{|>{hsize=0.22hsize}X|>{hsize=0.12hsize}X|>{hsize=0.36hsize}X|>{hsize=0.18hsize}X|>{hsize=0.12hsize}X|}
hline
centering Project N° & centering Unit & centering Document code & Serial N° & Rev. \ hline
centering ProjectCode & centering Unit & centering DocCode & centering SerialCode & Rev \ hline
end{tabularx}
centering
vskip 50pt par
includegraphics[scale=2]{./Figures/placeholder}
vskip 0.4in par
large{ClientProjectCode}
newline
vskip 0.15in par
large{ClientProjectName newline AT PlantName}
newline
vskip 0.5in par
begin{spacing}{1.7}
{LARGE DocTitle}
end{spacing}
%newline
%vskip 50pt par % Si el titulo es de dos lineas
vskip 70pt par % Si el titulo es de una linea
large{PREPARED BY}
newline
vskip 0.5in par
includegraphics[scale=1]{./Figures/placeholder}
vskip 0.55in par
%Titleblock
tiny
begin{spacing}{1.5}
begin{tabularx}{13cm}[b]{|>{hsize=0.05hsize}X|>{hsize=0.09hsize}X|>{hsize=0.26hsize}X|>{hsize=0.17hsize}X|>{hsize=0.17hsize}X|>{hsize=0.26hsize}X|}
hline
centering FsRev & FsDate & centering FsDesc & centering WrittenBy & centering CheckedBy & ApprovedBy / AuthorizeedBy \ hline
centering FsRev & FsDate & centering FsDesc & centering WrittenBy & centering CheckedBy & ApprovedBy / AuthorizeedBy \ hline
centering FsRev & FsDate & centering FsDesc & centering WrittenBy & centering CheckedBy & ApprovedBy / AuthorizeedBy \ hline
centering FsRev & FsDate & centering FsDesc & centering WrittenBy & centering CheckedBy & ApprovedBy / AuthorizeedBy \ hline
centering FsRev & FsDate & centering FsDesc & centering WrittenBy & centering CheckedBy & ApprovedBy / AuthorizeedBy \ hline
centering Rev. & centering DATE & centering STATUS & centering WRITTEN BY & centering CHECKED BY & APPROV BY / AUTHOR BY \ hline
multicolumn{6}{|c|}{DOCUMENT REVISIONS} \ hline
end{tabularx}
end{spacing}
%
%-------Different page Layout
newgeometry{textheight=20.35cm, headsep=60.0pt, footskip=50pt, hdivide={5cm,,}, bindingoffset=1cm, textwidth=13.5cm, includemp=false, marginparsep=70.0pt}
%
normalsize
justifying
%Raggedright
%-------Contenido
tableofcontents
newpage
section{SCOPE}
section{REFERENCE DOCUMENTS}
small
begin{description}
end{description}
normalsize
section{CALCULATION METHOD}
lipsum[1-10]
end{document}