Text Formattinghorizontal central alignment in picture environment

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
brac37
Posts: 5
Joined: Fri Jan 21, 2011 12:03 am

horizontal central alignment in picture environment

Post by brac37 »

Hello all,


I want to put text on some spot in a picture environment, with horizontal central alignment but no vertical alignment. With

Code: Select all

\put(10,10){\makebox(0,0){text}}
I get full central alignment, but I want capital letters ABC... to be placed higher than the letters gpqy which have about the same height, just as in normal text. Can this be achieved?
Last edited by brac37 on Mon Jan 31, 2011 2:32 pm, edited 1 time in total.

Recommended reading 2024:

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

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

achim
Posts: 49
Joined: Wed Aug 05, 2009 2:29 pm

horizontal central alignment in picture environment

Post by achim »

We can't find 'ABC' nor 'gpqw' in your code. How are we supposed to know what you're talking about?
Please provide a minimal working example and(/or) a better problem description, if you want an answer to your post.
OS: Kubuntu
Distribution: TexLive
Editor: Kile
brac37
Posts: 5
Joined: Fri Jan 21, 2011 12:03 am

Re: horizontal central alignment in picture environment

Post by brac37 »

The capital letters are entirely above the line, while the lower parts of gpqy are below the line. This is the case in every text you read. I currently use a quick and dirty solution of top alignment and white |'s around the text to make the text higher when only letters acegmnopqrsuvwxyz are used. These letters reach less high than others in every text you read.
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: horizontal central alignment in picture environment

Post by frabjous »

Re-read achim's post, and notice that what achim says is still true, and needs to be addressed. (Read also the link achim gives.)

We understand what you want. We don't (just) need a description. We need code to play around with. We're too lazy to make up our own examples, and it would be better for you do to that anyway to make it more relevant. Meet us halfway.
achim
Posts: 49
Joined: Wed Aug 05, 2009 2:29 pm

horizontal central alignment in picture environment

Post by achim »

I double frabjous' post once more.

With your still very vague problem description, all I can do is return an equally vague answer...

You might want to look in the pstricks packet. \rput offers you the option to align text on; center(c), top(c), bottom(b), baseline(B), left(l) and right(r).
OS: Kubuntu
Distribution: TexLive
Editor: Kile
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

horizontal central alignment in picture environment

Post by CrazyHorse »

brac37 wrote:Hello all,


I want to put text on some spot in a picture environment, with horizontal central alignment but no vertical alignment. With

Code: Select all

\put(10,10){\makebox(0,0){text}}
I get full central alignment, but I want capital letters ABC... to be placed higher than the letters gpqy which have about the same height, just as in normal text. Can this be achieved?

Code: Select all

\documentclass{article}
\begin{document}
\mbox{}
\put(10,10){\makebox(0,0)[B]{\vphantom{gf}GHG\_\_}}%
\put(40,10){\makebox(0,0)[B]{\vphantom{G}gfg\_\_}}

\end{document}
Herbert
brac37
Posts: 5
Joined: Fri Jan 21, 2011 12:03 am

horizontal central alignment in picture environment

Post by brac37 »

The vphantom command is less ugly than white text and works also better because no invisible characters will be selected in the pdf.

But I use the rput solution with baseline (capital B) alignment (\rput{0}(0,-2.5pt){text} instead of \makebox(0,0){text} to be precise), since this pstricks command seems to work with pdflatex as well. The -2.5pt is because the baseline is lower than the center of the text, pt is necessary because otherwise the wrong unit is used (in or cm or something).

Thanks all for your suggestions.

Here is an example, but it is actually meant for showing shearing.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

horizontal central alignment in picture environment

Post by localghost »

If the problem is solved now, please mark the topic (and not the last post) accordingly as written in Section 3 of the Board Rules (to be read before posting).


Thorsten
Post Reply