TeX - LaTeX Asked by S P Sharan on February 25, 2021
I’m trying to convert my resume made with Office to Latex. I wish to have my institute logo and then my information this way.
I am using this to do so:
documentclass[letterpaper]{article} % Paper Size
usepackage[margin=0.25in]{geometry}
raggedbottom
raggedright
usepackage{graphicx} % Images support
graphicspath{ {./assets/} } % Path to images
usepackage{multirow} % Columns spanning multiple rows (https://www.andy-roberts.net/writing/latex/tables)
usepackage[hidelinks]{hyperref} % Support hrefs
begin{document}
setlength{tabcolsep}{10pt} % Horizontal (column) spacing; Default value: 6pt
renewcommand{arraystretch}{1.25} % Vertical (row) spacing; Default value: 1
vfuzz=2in % Suppress vertical threshold warnings
begin{tabular*}{textwidth}{ c @{extracolsep{fill}} l l }
multirow{3}{*}{raisebox{-0.5in}{includegraphics[width=0.63in, height=0.63in]{NITT}}}
& textbf{S. P. Sharan} & textbf{Major : ECE $|$ Minor : Computer Appl.}
& textbf{National Institute of Technology Tiruchirappalli} & textbf{B. Tech. $3^{rd}$ Year}
& textbf{GitHub : href{https://github.com/Syzygianinfern0}{https://github.com/Syzygianinfern0}} & textbf{Mail ID : href{mailto:[email protected]}{[email protected]}}
end{tabular*}
end{document}
And this is the result. Although I am quite fine with the result, I don’t have control over the image size and this feels like a really hacky way to do so.
What is a better way to do the same?
There is an easy way to do it without hacking or guessing.
You put the 3 elements that make up the header (a logo plus two tables) in boxes. Then assemble the boxes taking into account their relative positions and alignment.
All of this can be accomplished using the package xcoffin
that behaves as a graphic layout program (boxes + relative positioning).
For convenience, I defined 3 lengths: the lateral side of the logo, its offset towards the left margin, and the separation between the three elements.
The assembly is done using a collector box (Framex
), joining the boxes one to the other while keeping their horizontal alignment
The expressions like (tablesep,0pt)
indicates the (X,Y)
offsets of the element being joined with respect to the other.
You can change the defined lengths, including the size of the logo, and see how the design adjusts on its own.
I assumed that you set a very small margin to be able to place the logo near the upper left corner. You don't need to do this now, because the package allows you to place "stuff" anywhere on the physical page, so I chose more standard margins.
documentclass[letterpaper]{article} % Paper Size
usepackage[left=1in,right=1in, top=1in, bottom=1in]{geometry}
raggedbottom
raggedright
usepackage{graphicx} % Images support
graphicspath{ {./assets/} } % Path to images
%usepackage{multirow} % Columns spanning multiple rows (https://www.andy-roberts.net/writing/latex/tables)
usepackage[hidelinks]{hyperref} % Support hrefs
usepackage{xcoffins} %needed
usepackage{kantlipsum} % dummy text
NewCoffinFramex %collector box
NewCoffinLogox
NewCoffinMidTable
NewCoffinRightTable
newlength{logoside}
newlength{logoindent}
newlength{tablesep}
setlength{logoindent}{-0.3in} %shift the logo into the left margin half its size
setlength{logoside}{0.6in} % size of the logo
setlength{tablesep}{0.1in} % horizontal separation between elements
% filling the boxes with its content
SetHorizontalCoffinLogox{includegraphics[width=logoside, height=logoside]{example-grid-100x100pt}}
SetHorizontalCoffinMidTable{%
renewcommand{arraystretch}{1.25}
bfseries
begin{tabular}{l}
S. P. Sharan
National Institute of Technology Tiruchirappalli
GitHub : href{https://github.com/Syzygianinfern0}{https://github.com/Syzygianinfern0}
end{tabular}
}
SetHorizontalCoffinRightTable{%
renewcommand{arraystretch}{1.25}
bfseries
begin{tabular}{l}
Major: ECE $|$ Minor: Computer Appl.
B. Tech. $mathbf{3^{rd}}$ Year
Mail ID : href{mailto:[email protected]}{[email protected]}
end{tabular}
}
%***********************************
% assembling the boxes ************
JoinCoffins*Framex[l,vc]Logox[l,vc](logoindent, -topmargin)
JoinCoffins*Framex[Logox-r,Logox-vc]MidTable[l,vc](tablesep,0pt)
JoinCoffins*Framex[MidTable-r,MidTable-vc]RightTable[l,vc](tablesep,0pt)
%%***********************
begin{document}
noindentTypesetCoffinFramex % type set the assembled set in the header space of the first page
kant[1-7]
end{document}
The package offer just a few commands and it is very easy to learn and apply.
Correct answer by Simon Dispa on February 25, 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