GeneralC++

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
mansniks
Posts: 9
Joined: Tue Jul 08, 2008 8:51 pm

C++

Post by mansniks »

Ah, may I ask one more: how can I make small, nice command, that prints C and "++" in actual font and size, just "++" is not that big, but still in center of "C"?
It is so nice to pretend, someone will answer! I just found this forum, lets see, what happen...

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

C++

Post by localghost »

Simply enlarge the "++" with a switch for the font size.

Code: Select all

C{\large ++}
This should already match your ideas.


Best regards and welcome to the board
Thorsten¹
mansniks
Posts: 9
Joined: Tue Jul 08, 2008 8:51 pm

Re: C++

Post by mansniks »

No, I meant smaller! And it displays not in center...
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

C++

Post by localghost »

OK, obviously a misunderstanding. The switch for the font size goes in the other direction and the characters are raised a little bit above the base line.

Code: Select all

C\raisebox{1pt}{\small ++}
In case the "++" still has to be smaller, you may have to adapt the value for raising.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

C++

Post by gmedina »

Try something like the \Cp command that I defined in the following example:

Code: Select all

\documentclass{article}
\DeclareRobustCommand{\Cp}
	   {C\protect\raisebox{0.2ex}{\small ++}}

\begin{document}

C++

\Cp

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
mansniks
Posts: 9
Joined: Tue Jul 08, 2008 8:51 pm

Re: C++

Post by mansniks »

Ok, that goes good as a quick solution, but it would be nice, that number for raisebox would be relative...
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

C++

Post by localghost »

mansniks wrote:Ok, that goes good as a quick solution, but it would be nice, that number for raisebox would be relative...
The solution provided by gmedina depends on the current font size and therefore is more universal hence preferable.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

C++

Post by Stefan Kottwitz »

Hi,

here's a similar solution, perhaps you want to try it too at different sizes, shapes and font families:

Code: Select all

\usepackage{relsize}
\def\C++{%
\ifdim\fontdimen3\font=0pt C++%
\else C\kern-.16em\raise.35ex\hbox{\relsize{-2}{++}}\fi}
Stefan
LaTeX.org admin
mansniks
Posts: 9
Joined: Tue Jul 08, 2008 8:51 pm

Re: C++

Post by mansniks »

Thank you all. I see, that you answer quite soon and I like it!
Post Reply