1

I am trying to automate this:

enter image description here

I found this tip which provides the small caps (cool!) but not the bold first letter. The "bold first letter" answers I found were too convoluted for me to use them with what I already found. Can someone help me out?

\documentclass{article}
\providecommand\newthought[1]{%
   \addvspace{1.0\baselineskip plus 0.5ex minus 0.2ex}%
   \noindent\textsc{#1} % small caps text out
}
    \begin{document}

\newthought{\textbf{W}hat you see here} a new thought.

\end{document}
  • The capital letter of a small cap font is the same as capital letter in normal font so the W is the same within sc or outside it. – Sigur Jan 19 '16 at 23:52
6

Or this? This allows you to pass a single argument rather than two. Unlike my original code, this makes an approximate adjustment for the loss of kerning when switching fonts (bold -> small-caps), based on David's suggestion.

\documentclass{article}% don't use minimal for examples
\newlength\ltempa
\newlength\ltempb
\newcommand\newthought[1]{%
   \addvspace{1.0\baselineskip plus 0.5ex minus 0.2ex}%
   \noindent\expandafter\formatnewthought#1\relax}
\def\formatnewthought#1#2\relax{%
  \settowidth\ltempa{\textsc{#1#2}}%
  \settowidth\ltempb{\textsc{#1\mbox{}#2}}%
  \addtolength\ltempa{-\ltempb}%
  \textbf{#1}\kern\ltempa\textsc{#2}%
}
\begin{document}

\newthought{What you see here} a new thought.

\end{document}

new thought in one

Here's a comparison of the current definition, with the kerning adjustment, and my original definition, which made no adjustment for kerning:

vacuum variations

  • I'm also not sure you want the \addvspace part. – cfr Jan 20 '16 at 0:17
  • 1
    yes , like that:-) – David Carlisle Jan 20 '16 at 1:16
  • I removed the \addvspace part per @cfr's recommendation, and it seems to have done nothing (except removing superfluous space, of course.) – Kristian Nordestgaard Jul 17 '16 at 23:01
  • @KristianNordestgaard Er ... what were you expecting it to do? – cfr Jul 17 '16 at 23:21
  • @cfr: I'll have to think about that ;) – Kristian Nordestgaard Jul 18 '16 at 9:44
2

Is this what you want?

The command newthought now has 2 arguments and the 1st is the first letter to be typeset in bold.

\documentclass{minimal}
\providecommand\newthought[2]{%
   \addvspace{1.0\baselineskip plus 0.5ex minus 0.2ex}%
   \noindent\textbf{#1}\textsc{#2}% small caps text out
  %\noindent\textsc{\textbf{#1}#2}% prettier code
}
    \begin{document}

\newthought{W}{hat you see here} a new thought.

\end{document}

ps. I'm not sure you need the \addvspace part.

enter image description here

  • 1
    Maybe worth noting that this loses kerning. (Inevitably.) – cfr Jan 20 '16 at 0:02
  • 1
    @cfr if you wanted to put the kerning back you could compare the width of \textsc{Wh} and \textsc{W\mbox{}h} and add a a kern of the difference (which ignores the difference between a bold and non-bold first letter, but still.) – David Carlisle Jan 20 '16 at 0:37
  • @DavidCarlisle Thanks! You mean like this? (Below, not above, obviously.) – cfr Jan 20 '16 at 1:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.