0

I want the name of my theorm, definition etc. to be in bold. I use my own TheoremStyle which is :

\swapnumbers
\makeatletter
\newtheoremstyle{myStyle}
  {12pt}        % Space above, empty = `usual value'
  {10pt}        % Space below
  {\itshape}    % Body font
  {}            % Indent amount 
  {\bfseries}   % Thm head font
  {.}           % Punctuation after thm head
  { }           % Space after thm head: \newline = linebreak
  {\thmname{#1}\thmnumber{\@ifnotempty{#1}{ }\@upn{#2}}%
\thmnote{    {\bfseries(#3)}}} % Thm head spec (doesn' work !!!)
 \makeatother

I have cheched all related questions, tried all solutions proposed which seem to work for other people (like the one above), but nothing works. The problem seems to come from an interaction with \swapnumbers :

With \swapnumbers I get for instance : 1.1.4 Théorème (Théorème d’approximation de Whitney)

But without \swapnumbers it becomes : Théorème 1.1.4 (Théorème d’approximation de Whitney)

What I want is: 1.1.4 Théorème (Théorème d’approximation de Whitney)

I use TexShop 3.62. Any idea ?

  • Welcome to TeX.SX! Can you please add a minimal example where you define a theorem and use it? – egreg Dec 14 '17 at 10:57
  • Since you're defining the style yourself, why should you use \swapnumbers? – egreg Dec 14 '17 at 11:01
  • @egreg because I didn't know it is possible to define swapnumbers in myStyle. How do you do it ? – ychemama Dec 14 '17 at 11:05
  • Please give a working sample! Don't let's guess although I may guess how to get what is your desired! – Mogic Dec 14 '17 at 11:06
  • Don't you already have first the name and then the number? – egreg Dec 14 '17 at 11:06
2

I fixed your codes which may get what you want:

\documentclass{book}
\usepackage{amsmath,amsfonts,amsthm}
\makeatletter
\newtheoremstyle{myStyle}
  {1ex plus 0.2ex minus 0.1ex} % Space above
  {1ex plus 0.2ex minus 0.1ex} % Space below
  {\itshape}    % Body font
  {}            % Indent amount 
  {\bfseries}   % Thm head font
  {.}           % Punctuation after thm head
  {0.5em}       % Space after thm head: \newline = linebreak
  {\thmnumber{#2.}~\thmname{#1}~\thmnote{(#3)}}
\makeatother
\theoremstyle{myStyle} 
\newtheorem{theorem}{Theorem}[section]

\begin{document}
\chapter{Sample}
\section{Section}

\begin{theorem}[Theoreme d’approximation de Whitney]
What I want is: $\Sigma=\{a\in A\mid f(a)=3\}$.
\end{theorem}

\end{document}

Five items are changed:

  • delte \@ifnotempty{#1}{ }\@upn{#2} since it's unnecessary.
  • change the order of #1 and #2 instead of using \swapnumbers
  • theorem numbers should be added .
  • spaces above and below should have some possibility as above.
  • add a space 0.5em after the theorem head.

The PDF style is enter image description here

| improve this answer | |
  • Thx it also works. – ychemama Dec 14 '17 at 11:36

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.