I think you are confusing visual markup with semantic markup.
\emph
is semantic markup: it indicates that you want to emphasize some text, without specifying how that will affect the appearance of the text. The default is to make it italic, or for nested emph-within-emph to make it roman again. However, the default can be overridden if you later decide to use bold for emphasis: \renewcommand\emph{\textbf}
.
\texttt
, \textmd
, \textsc
and so on are visual markup. You should use them for implementing semantic markup. So, for example if you want to use the French convention of using small caps for family names, you could write \newcommand\familyname{\textsc}
and have This was studied by John \familyname{Smith} and \familyname{Yao} Ming
. If you then later decided that you no longer like this convention it is easy to change, in the preamble without needing to search through your text. Similarly you may want to write \newcommand\code{\texttt}
The visual \textXX
commands will change 3 axes of the text: shape, family and weight.
- The shape axis covers:
\textup
, \textit
, \textsc
and \textsl
- The family axis covers:
\textrm
, \textsf
, \texttt
- The weight axis covers:
\textbf
, \textmd
- Some fonts provide other options along these axes, or even as with MinionPro, completely new axes. (This functionality is now available independent of MinionPro in the
fontaxes
package, so that it can be used with other fonts.)
You can combine options from the different axes (some combinations, such as \textbf{\textt{...}}
are not available by default, discussed here). For example:
\newcommand\keyword[1]{\textsf{\textbf{#1}}}
\newcommand\important[1]{\textbf{\textit{#1}}}
Regarding "HI-TECH C PIC Compiler": Some fonts (especially ones aimed at newspaper and magazine publishing) have a size of capitals that is intermediate between small-caps (\textsc
) and full capitals, for exactly this purpose. The default tex computer modern fonts do not have this possibility, but the computer modern \textsc
is not a true small-caps, being a little taller than the x-height of the font, so can be used this way: \newcommand\hitechcomp{\textsc{hi-tech c pic} compiler}
This is a very interesting layout. Try the following code. A boolean is hooked to the \everypar
. This means that if there is plain paragraph first it is set to false and the next subsection will have normal spacing. Note also the strange place where the \secskip
command end up, but it seems to work.
EDIT 1: Restore original \everypar
and remove vertical space of \lastskip
before moving subsection up. Remove all glue and add \raggedbottom
to prevent stretching.
EDIT 2: It looks if the additional vertical spacing is \baselineskip
\usepackage{titlesec}
\makeatletter
\newif\ifaftersec\aftersecfalse
\newcommand\setsubskip{%
\global\aftersectrue
\everypar{%
\global\aftersecfalse
\if@noskipsec
\global\@noskipsecfalse
\clubpenalty\@M
\hskip-\parindent
\begingroup
\@svsechd\unskip{\hspace{\@tempskipb}}%
\endgroup
\else
\clubpenalty\@clubpenalty\everypar{}%
\fi}}
\newcommand\subskip{%
\ifaftersec
\removelastskip% EDIT 2
\vspace{-\baselineskip}% EDIT 2 ??????????????
\fi
\global\aftersecfalse}
\titleformat{\section}[leftmargin]{\raggedright\scshape}{}{0pt}{}[\setsubskip]
\titlespacing*{\section}{2.5cm}{2.5ex}{0.5cm}
\titleformat{\subsection}{\subskip\bfseries}{}{0pt}{}[]
\titlespacing*{\subsection}{0pt}{2ex}{1ex}
\raggedbottom
\makeatother
Best Answer
Pages 26-27 of the titlesec documentation show "how [the] sectioning commands of the standard classes could be defined" using titlesec commands. Take the definition of
\paragraph
and change the optional "format" argument of\titleformat
fromrunin
tohang
(or drop it entirely).EDIT: To make a
\paragraph
look exactly like a\section
in the article class, use