Page LayoutGraphic not displayed as I want (centered)

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
vgwosdz
Posts: 1
Joined: Wed Dec 01, 2021 9:39 am

Graphic not displayed as I want (centered)

Post by vgwosdz »

I am new to LaTeX, but with the help of templates and forums, I have been able to create an exam template. All is as I want it to be, except for our school logo, which is displayed in the top of the cell rather than centered.

This is the piece of code

Code: Select all

\def\hoofdingrepetitie#1#2#3#4{
\noindent 
\hspace{-0.5cm}
\begin{tabular}{|l|c|l|} 
\hline 
\parbox[l]{1cm}\
{
\includegraphics[width=3cm]{LogoSPT.jpg}
 }

&
\raisebox{1.4cm}{

I have tried to center the logo (then it doesn't show at all) or add a vspace, also no effect. Can anyone point me to what I am missing?

Thanks!
Last edited by Stefan Kottwitz on Wed Dec 01, 2021 1:35 pm, edited 1 time in total.
Reason: code marked

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Graphic not displayed as I want (centered)

Post by Ijon Tichy »

You code is broken. For example:
  • \parbox does not provide an option l but only t, b or c (and s for the innerpos optional argument). See the usrguide or a introduction to LaTeX for more information.
  • The \ at the end of \parbox[l]{1cm}\ is interpeted as space token and as the argument of the \parbox command. Unfortunately I do not see any intention for the command. So I cannot tell, what the correct code for this would be.
  • There are potential white spaces at the definition like the line end after \def\hoofdingrepetitie#1#2#3#4{ or \hspace{-0.5cm}.
You code is also not a Infominimal working example, so we cannot reproduce the problem. And your description of the problem is quite unclear. I think you mean vertically centered inside the tabular.

Altogether, I can only speculate, that replacing the \parbox by a \raisebox with suitable raise value can solve your problem. Perhaps you have also to change or remove the existing \raisebox. But—as explained—this is only speculation, because the code is incomplete and not working.

Your code is also not correctly marked as code.

However, with all such mistakes in the code, I fear that the rest of the code is not much better. So I'm sorry but I really hope you will not provide a template with code like this. Unfortunately, published code like the shown is one reason, why so much beginners have so much problems.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Post Reply