General ⇒ C++
C++
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...
It is so nice to pretend, someone will answer! I just found this forum, lets see, what happen...
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++
Simply enlarge the "++" with a switch for the font size.
This should already match your ideas.
Best regards and welcome to the board
Thorsten¹
Code: Select all
C{\large ++}
Best regards and welcome to the board
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
C++
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.
In case the "++" still has to be smaller, you may have to adapt the value for raising.
Code: Select all
C\raisebox{1pt}{\small ++}
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
C++
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,...
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
C++
The solution provided by gmedina depends on the current font size and therefore is more universal hence preferable.mansniks wrote:Ok, that goes good as a quick solution, but it would be nice, that number for raisebox would be relative...
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
C++
Hi,
here's a similar solution, perhaps you want to try it too at different sizes, shapes and font families:
Stefan
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}
LaTeX.org admin