9

I want to add a small text on a regular one. It looks like a superscript but the difference is the regular text won't have any break. I don't know how to explain the situation correctly so I added a sample image showing what I want to do.

enter image description here

Any suggestions how to type this in latex?

tarik
  • 73

7 Answers7

11

Just for fun, with the experimental xcoffins package. Special alignment tasks like this formed some of the inspiration for this new package/feature.

The two text elements are set in separate "coffins". The smaller one is then scaled down. (Since I've already used the full gamut of design type sizes available: \tiny-\Huge.)

Finally, the coffins are joined by their right top (r,t) poles with an (optional) offset (0pt,-0.1em) before being typeset.

\documentclass[border=2pt]{standalone}
\usepackage{xcoffins}
\NewCoffin\BigText
\NewCoffin\SmallText

\begin{document}\sffamily
  \SetHorizontalCoffin\BigText{\Huge Tex}%
  \SetHorizontalCoffin\SmallText{\tiny Superscript}%
  \ScaleCoffin\SmallText{0.75}{0.75}%
  \JoinCoffins\BigText[r,t]\SmallText[r,t](0pt,-0.1em)%
  \TypesetCoffin\BigText
\end{document}

enter image description here

The kerning was not the focus of the question, but since it has been mentioned in a comment: it is quite easy to add if desired.

\documentclass[border=2pt]{standalone}
\usepackage{xcoffins}
\NewCoffin\BigText
\NewCoffin\SmallText

\begin{document}\sffamily
  \SetHorizontalCoffin\BigText{\Huge T\kern-0.175emex}%
  \SetHorizontalCoffin\SmallText{\tiny Superscript}%
  \ScaleCoffin\SmallText{0.65}{0.65}%
  \JoinCoffins\BigText[r,t]\SmallText[r,t](0pt,-0.15em)%
  \TypesetCoffin\BigText
\end{document}

enter image description here

Paul Gessler
  • 29,607
  • nice, but too bad the kerning between "T" and "e" is lost. – barbara beeton Feb 13 '15 at 17:40
  • @barbarabeeton what would cause the kerning to be lost? I don't think it is lost. It looks the same as David's to me. – Paul Gessler Feb 13 '15 at 17:44
  • yes, but david's looks so dreadful that i didn't even bother to comment. look at the kerning in the original example. it's maybe just a hair tight for my taste, but better than most others here. the goal should be to have the same visual spacing between the "T" and the "e" as there is between the "e" and the "x"; obviously, this is somewhat subjective, but it's one of the things that differentiates a good professional font from an amateur one. (i think knuth didn't kern cap/lowercase pairs in most cm fonts; a shame, really. others have remarked on that too.) – barbara beeton Feb 13 '15 at 17:51
  • @barbarabeeton ah, ok. I thought you meant that something I did broke the normal kerning of the T-e pair. Anyway, it could be easily added, but that was not the focus of the question. – Paul Gessler Feb 13 '15 at 18:38
8

Something like that? I used the stackengine package:

\documentclass[a4paper, 12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[x11names]{xcolor} 
\usepackage{stackengine}

\begin{document}

\setstackgap{S}{-1.6ex}
\def\stackalignment{r}
\stackon{\color{IndianRed3}\fontsize{60}{0}\selectfont\sffamily\bfseries T{\kern-0.15em}ex}{\sffamily\scriptsize\color{LightSteelBlue3} Superscript\kern0.6em}

\end{document}

Edit: As pointed by Steven B. Segletes, you may obtain the same result with the \stackinset command, which has a simpler syntax in this situation:

\stackinset{r}{1em}{t}{0.1ex}{\sffamily\scriptsize\color{LightSteelBlue3} Superscript}{\color{IndianRed3}\fontsize{60}{0}\selectfont\sffamily\bfseries Tex}

It has 6 arguments: the first two are horizontal alignment and a possible horizontal offset; the next two are verticakl alignment and a vertical offset. The last two are the inset and anchor items themselves (in that order).

enter image description here

Bernard
  • 271,350
  • You beat me to it, though I am using a \stackinset. – Steven B. Segletes Feb 13 '15 at 19:10
  • @ Steven B. Segletes: Thanks for your comment. I incorporated your suggestion into my answer. I don't use your package very often, so I didn't think of this solution, which is simpler for such a job, in my opinion. – Bernard Feb 13 '15 at 20:04
6

enter image description here

\documentclass{article}

\begin{document}
\sffamily

\Huge Tex%
\begin{picture}(0,0)
\put(-25,11.5){\tiny Superscript}
\end{picture}

\end{document}
David Carlisle
  • 757,742
  • 1
    I'm assuming here that this is for some kind of logo setting where fine tuning the exact placement by coordinate makes sense. If you actually want the kind of running annotation as used in some linguistic applications or Japanese Ruby, then you want a different method (and there are specialist packages available) – David Carlisle Feb 13 '15 at 14:14
4

Can't let this go without tikz, so game on:

\documentclass[tikz,border=4mm]{standalone}

\begin{document}
\begin{tikzpicture}[inner sep=0pt]
  \node[font=\sffamily\Huge] (a) {Tex};
  \node[scale=0.4,font=\sffamily,anchor=north east,yshift=-0.3ex] at (a.north east) {Superscript};
\end{tikzpicture}
\end{document}

enter image description here

4

May I contribute with a MetaPost solution? :-) It uses the tight integration of MetaPost in LuaLaTeX, directly using the document fonts and font-related specific units of TeX (em, ex).

\documentclass{article}
\usepackage{luamplib}
\begin{document}
{\sffamily
\begin{mplibcode}
beginfig(1);
  draw textext("\Huge Tex"); 
  draw textext("\tiny Superscript") scaled .75 shifted (\mpdim{1.6em}, \mpdim{2.8ex});; 
endfig;         
\end{mplibcode}}
\end{document}

enter image description here

Franck Pastor
  • 18,756
3

Another simple solution with boxes

\documentclass{standalone}

\begin{document}
\makebox[4em][l]{%
  \sffamily
  \huge T%
  \makebox[-4pt][l]{\raisebox{1.3ex}{\tiny superscript}}%
  \Huge ex%
}
\end{document}

preview

Bordaigorl
  • 15,135
3

Like Bernard, I use stackengine, but here I use a \stackinset, instead of a \stackon.

\documentclass{article}
\usepackage{stackengine,graphicx}
\begin{document}
\sffamily\stackinset{r}{2ex}{t}{2pt}{Superscript}{\scalebox{7}{Tex}}
\end{document}

enter image description here