LyX ⇒ Centering image on page
Centering image on page
In the appendix, I want to include several images, one image per page (imagine reproductions of a manuscript). Centering it horizontally works fine, but how can I vertically center the image on the page? I was unable to find an answer online, there must be a simple solution.
Thanks!
Edit: The question has indeed been asked before, but no answer was provided: http://latex.org/forum/viewtopic.php?f=45&t=16016
Edit2: Okay, placing \vspace*{\fill} before and after the image should do the deal! Sometimes one has to ask first before being able to find a solution for himself.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
Centering image on page
no problem! Great to see that your question is quickly solved, an thanks for posting your solution.
By the way, for centering on the page the margins should be the same for top and bottom. The command aboves centers within the text area.
Stefan
Centering image on page
I am working with LyX but the code looks like this:
\newpage{}
\begin{center}
\vspace*{\fill}\includegraphics[width=15cm]{\string"image1".png}\vspace*{\fill}
\par\end{center}
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
Centering image on page
\vspace*{\fill}
commands should be outside the center environment, so before \begin{center}
and after \end{center}
.Stefan
Centering image on page
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
Centering image on page
Stefan
Centering image on page
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
Centering image on page
Stefan
Centering image on page
I've got another question for which I'll open another thread.
Edit: Well, the other question concerned hyphenation. My hyphenation rule did not work because \usepackage{babel} followed after \hyphenation{Renais-sance}. To put it behind I seem to have to include it as a TeX code in the LyX document itself instead of the preamble.
Code: Select all
\documentclass[12pt,ngerman]{article}
\usepackage{mathptmx}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm}
\usepackage{graphicx}
\usepackage{setspace}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{blindtext}
\hyphenation{Renais-sance}
\makeatother
\usepackage{babel}
\begin{document}
\appendix
\section{Anhang}
\subsection{Test}
\blindtext
\subsection{Hyphenation}
Renaissance Renaissance Renaissance Renaissance Renaissance Renaissance
Renaissance Renaissance Renaissance Renaissance Renaissance Renaissance
Renaissance Renaissance Renaissance Renaissance
\newpage{}
\vspace*{\fill}
\begin{center}
\includegraphics[width=15cm]{test}
\par\end{center}
\vspace*{\fill}
\newpage{}
\vspace*{\fill}
\begin{center}
\includegraphics[width=15cm]{test}
\par\end{center}
\vspace*{\fill}
\newpage{}
\vspace*{\fill}
\begin{center}
\includegraphics[width=15cm]{test}
\par\end{center}
\vspace*{\fill}
\end{document}
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
Centering image on page

Stefan