General ⇒ Vertical alignment - pictures in tex
-
- Posts: 6
- Joined: Sun Jun 01, 2008 2:34 pm
Vertical alignment - pictures in tex
I hope you can help me with a tiny alignment problem. I want to use small pictures in my text, and used includegraphics{} to dot hat. So far so good, but the pictures are slightly larger than the text and I want the middle of the pictures to be aligned witht he the middle of the text - currently the bottoms of pictures and text are on the same height.. I imagine there is a short way to fix this but I don't know it.
Thanks for any help
Pere
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Vertical alignment - pictures in tex
Best regards and welcome aboard
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 6
- Joined: Sun Jun 01, 2008 2:34 pm
Vertical alignment - pictures in tex
I don't know how to use a dummy graphic so I attached one.
Here is the code for the MWE
Code: Select all
\documentclass{article}
\usepackage{graphicx}
\begin{document}
I would like this black box \includegraphics{dummy} to be vertically centered.
\end{document}
Thanks again
Pere
- Attachments
-
- dummy.pdf
- (913 Bytes) Downloaded 214 times
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Vertical alignment - pictures in tex
Code: Select all
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{txfonts} % Additional font package
\parindent0em
\begin{document}
I would like this black box \rule{11pt}{11pt} to be vertically centered.
\medskip
This black box \begin{minipage}{11pt}\rule{11pt}{11pt}\end{minipage} is now vertically centered.
\end{document}
Code: Select all
This small graphic \begin{minipage}{11pt}\includegraphics[width=11pt]{dummy}\end{minipage} is now vertically centered.
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 6
- Joined: Sun Jun 01, 2008 2:34 pm