日付の変更

日付の変更
        \documentclass[a4paper,10pt,demo    ]{article} %
    \usepackage{pifont} %bouni
    %-----accent
    \usepackage[latin1]{inputenc} %écrire directement les accents et il peut poser des problème
    \usepackage[T1]{fontenc}
      %-----
    \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
     \usepackage{graphicx}                    % Enable pdflatex
      \usepackage{wrapfig}
      \usepackage{amsmath,amsfonts,amsthm}     % Math packages
      %%%%%%%%%%%%% dimension ancien des marges %%%%%%%%%%%%%%%%%%%%
      \usepackage{geometry}
      \geometry{left=2cm,right=2cm,top=1.5cm,bottom=1.5cm}
      %%%%%%%%%%%%% style des sections %%%%%%%%%%%%%%%%%%%%
     \frenchspacing              % Better looking spacings after periods
      \usepackage{sectsty}
      \sectionfont{%                        % Change font of \section 
         command
    \usefont{OT1}{phv}{b}{n}%       % bch-b-n: CharterBT-Bold font
     \sectionrule{0pt}{0pt}{-5pt}{1pt}}
     %%%%%%%%%%%%%%%% Macros %%%%%%%%%%%%%%%%%%%%
      \newcommand{\sepspace}{\vspace*{1em}}     % Vertical space macro
      \newcommand{\MyName}[1]{ % Name
        \Huge \usefont{OT1}{phv}{b}{n} \hfill #1
        \par \normalsize \normalfont}
      \newcommand{\MySlogan}[1]{ % Slogan}{optional)
    \large \usefont{OT1}{phv}{m}{n}\hfill \textit{#1}
    \par \normalsize \normalfont}
      %%% ------------------------------------------------------------
      \pagestyle{empty}           % No pagenumbers/headers/footers
     %%%%%%%%%%%%%%%%%%%%% Begin Document %%%%%%%%%%%%%%%%%%%%%%%%%
     \begin{document}
     %%%%%%%%%%%%%%%%%% Photo et title %%%%%%%%%%%%%%%%%%%%%%%%%
    %---------------------------
   %---------------------------
   \MyName{Name Name}
    \MySlogan{Curriculum Vitae \\ \null\hfill  (\today)}
    %\MySlogan{Curriculum Vitae (October 2016)}
    %---------------------------
    \sepspace  % Si on ajoute encore \sepspace on aura plus d'espace
    $$$$
     %%%%%%%%%%%%%% Personal details%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \section*{Informations personelles}

    \end{document}

次のように日付に「th」を追加したい

ここに画像の説明を入力してください

答え1

犯人はここにいる

  1. 希望する日付(月日順、年)に適したレイアウトを見つけ、
  2. 数値と順序の間の距離を変更します。

この 2 つの点をテストするには、次の MWE を参照してください。

\documentclass{article}

\usepackage[en-GB,en-CA,en-US]{datetime2}

%\usepackage{etoolbox}
%\patchcmd{\DTMenglishordinal}% <cmd>
%  {#1 \DTMenglishfmtordsuffix}% <search>
%  {#1\,\DTMenglishfmtordsuffix}% <replace>
%  {}{}% <success><failure>


\begin{document}

british: 
\DTMsetstyle{en-GB}\today.
\DTMlangsetup[en-GB]{ord=raise} % ,monthyearsep={,\space},abbr
\DTMsetstyle{en-GB}\emph{\today} \today

canadian:
\DTMlangsetup[en-CA]{ord=raise} % ,monthyearsep={,\space},abbr  ,ordsep={\,}
\DTMsetstyle{en-CA}\emph{\today} \today

american:
\DTMlangsetup[en-US]{ord=raise} % ,monthyearsep={,\space},abbr
\DTMsetstyle{en-US}\emph{\today} \today

\end{document}

その結果、希望する日付レイアウトを取得するには、カナダまたはアメリカのバリアントを選択できることがわかります。ドキュメントで斜体フォントを使用したため、上記の MWE で日付の斜体と通常のテキストを表示しました。

変種

このバリアントでは、numberとordの間の距離が結果よりも少し大きいことがわかりますが、距離をさらに広げたい場合は、行のコメントを解除してください。

%\usepackage{etoolbox}
%\patchcmd{\DTMenglishordinal}% <cmd>
%  {#1 \DTMenglishfmtordsuffix}% <search>
%  {#1\,\DTMenglishfmtordsuffix}% <replace>
%  {}{}% <success><failure>

パッチをアクティブにするには、上記の MWE で次のように記述します。このパッチは、\,(コード内で で表される) 番号の後に小さなスキップを追加します#1。これで、次のような結果が得られます。

小さなスキップで日付

さて、見つかったコード(私はアメリカ版を選択しました)をコードに含めることができます。

\documentclass[%
  a4paper,
  10pt,
  demo
]{article}

\usepackage[en-US]{datetime2} % <=======================================
\DTMlangsetup[en-US]{ord=raise}

\usepackage{etoolbox} % <===============================================
\patchcmd{\DTMenglishordinal}% <cmd> <==================================
  {#1 \DTMenglishfmtordsuffix}% <search>
  {#1\,\DTMenglishfmtordsuffix}% <replace>
  {}{}% <success><failure>

\usepackage{pifont} %bouni

\usepackage[latin1]{inputenc} %écrire directement les accents et il peut poser des problème
\usepackage[T1]{fontenc}

\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
\usepackage{graphicx}                    % Enable pdflatex
\usepackage{wrapfig}
\usepackage{amsmath,amsfonts,amsthm}     % Math packages

\usepackage{geometry}
\geometry{left=2cm,right=2cm,top=1.5cm,bottom=1.5cm}

\frenchspacing              % Better looking spacings after periods
\usepackage{sectsty}
\sectionfont{%                        % Change font of \section 
  command % <=================================================== ???????
  \usefont{OT1}{phv}{b}{n}%       % bch-b-n: CharterBT-Bold font
  \sectionrule{0pt}{0pt}{-5pt}{1pt}}

\newcommand{\sepspace}{\vspace*{1em}}     % Vertical space macro
\newcommand{\MyName}[1]{ % Name
        \Huge \usefont{OT1}{phv}{b}{n} \hfill #1
        \par \normalsize \normalfont}
\newcommand{\MySlogan}[1]{ % Slogan}{optional)
    \large \usefont{OT1}{phv}{m}{n}\hfill \textit{#1}
    \par \normalsize \normalfont}

\pagestyle{empty}           % No pagenumbers/headers/footers


\begin{document}

\MyName{Name Name}
\MySlogan{Curriculum Vitae \\ \null\hfill  (\DTMsetstyle{en-US}\today)} % <=======================

\sepspace  % Si on ajoute encore \sepspace on aura plus d'espace

\section*{Informations personelles}

\end{document}

結果:

修正したコード

赤い下線付きの「コマンド」は、コード内で でマークした行から来ています。これが必要な内容ですか? そうでない場合は、コード内の<====== ?????の行を削除してください。command

答え2

パッケージを使用してdatetime、(見る datetime.stypdf、p:8):

     \documentclass[a4paper,10pt,demo    ]{article} %
      \usepackage{datetime}
      \newdateformat{dashdate}{%
\twodigit{\THEDAY}-\twodigit{\THEMONTH}-\THEYEAR}
\newdateformat{usvardate}{%
\monthname[\THEMONTH] \ordinal{DAY}, \THEYEAR}

    \usepackage{pifont} %bouni
    %-----accent
    \usepackage[latin1]{inputenc} %écrire directement les accents et il peut poser des problème
    \usepackage[T1]{fontenc}
      %-----
    \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
     \usepackage{graphicx}                    % Enable pdflatex
      \usepackage{wrapfig}
      \usepackage{amsmath,amsfonts,amsthm}     % Math packages
      %%%%%%%%%%%%% dimension ancien des marges %%%%%%%%%%%%%%%%%%%%
      \usepackage{geometry}
      \geometry{left=2cm,right=2cm,top=1.5cm,bottom=1.5cm}
      %%%%%%%%%%%%% style des sections %%%%%%%%%%%%%%%%%%%%
     \frenchspacing              % Better looking spacings after periods
      \usepackage{sectsty}
      \sectionfont{%                        % Change font of \section 
         command
    \usefont{OT1}{phv}{b}{n}%       % bch-b-n: CharterBT-Bold font
     \sectionrule{0pt}{0pt}{-5pt}{1pt}}
     %%%%%%%%%%%%%%%% Macros %%%%%%%%%%%%%%%%%%%%
      \newcommand{\sepspace}{\vspace*{1em}}     % Vertical space macro
      \newcommand{\MyName}[1]{ % Name
        \Huge \usefont{OT1}{phv}{b}{n} \hfill #1
        \par \normalsize \normalfont}
      \newcommand{\MySlogan}[1]{ % Slogan}{optional)
    \large \usefont{OT1}{phv}{m}{n}\hfill \textit{#1}
    \par \normalsize \normalfont}
      %%% ------------------------------------------------------------
      \pagestyle{empty}           % No pagenumbers/headers/footers
     %%%%%%%%%%%%%%%%%%%%% Begin Document %%%%%%%%%%%%%%%%%%%%%%%%%
     \begin{document}
     %%%%%%%%%%%%%%%%%% Photo et title %%%%%%%%%%%%%%%%%%%%%%%%%
    %---------------------------
   %---------------------------
   \MyName{Name Name}
    \MySlogan{Curriculum Vitae \\ \null\hfill  (\usvardate\today)}
    %\MySlogan{Curriculum Vitae (October 2016)}
    %---------------------------
    \sepspace  % Si on ajoute encore \sepspace on aura plus d'espace
    $$$$
     %%%%%%%%%%%%%% Personal details%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \section*{Informations personelles}

    \end{document}

  [1]: 

ここに画像の説明を入力してください

答え3

以下はdatetime2序数を設定するためのアプローチは、ferahfeza の回答さらに、序数の配置に若干の調整が導入されます。

ここに画像の説明を入力してください

\documentclass{article}

\usepackage[T1]{fontenc}

\usepackage{fmtcount}
\usepackage[calc,english]{datetime2}
\DTMnewdatestyle{usvardate}{%
  \renewcommand{\DTMdisplaydate}[4]{%
    \DTMmonthname{##2} \ordinalnum{##3}, \number##1 }%
  \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}%
}

\makeatletter
\AtBeginDocument{
  \renewcommand{\fmtord}[1]{\,\fc@textsuperscript{#1}}% Add \, before ordinal number
}
\makeatother

\newcommand{\MyName}[1]{ % Name
  \Huge \usefont{OT1}{phv}{b}{n} \hfill #1
  \par \normalsize \normalfont}
\newcommand{\MySlogan}[1]{ % Slogan}{optional)
  \large \usefont{OT1}{phv}{m}{n}\hfill \textit{#1}
  \par \normalsize \normalfont}

\begin{document}

\MyName{Name Name}
\MySlogan{Curriculum Vitae \\ \null\hfill  (\DTMsetdatestyle{usvardate}\today)}

\end{document}

関連情報