Skip to content

Commit 5ca060c

Browse files
committed
Fix horizontal alignment around /unspecified/ placeholders in the library.
This adds the \itcorr command which can be used to insert spacing corresponding to the width of the italic correction for the current font (and \itcorr[-1] which can be used to remove said spacing).
1 parent 3ee5ff4 commit 5ca060c

File tree

5 files changed

+57
-48
lines changed

5 files changed

+57
-48
lines changed

source/iostreams.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4137,11 +4137,11 @@
41374137

41384138
template <class charT, class traits, class Allocator>
41394139
@\textit{T12}@ quoted(const basic_string<charT, traits, Allocator>& s,
4140-
charT delim=charT('"'), charT escape=charT('\\'));
4140+
@\itcorr@ charT delim=charT('"'), charT escape=charT('\\'));
41414141

41424142
template <class charT, class traits, class Allocator>
41434143
@\textit{T13}@ quoted(basic_string<charT, traits, Allocator>& s,
4144-
charT delim=charT('"'), charT escape=charT('\\'));
4144+
@\itcorr@ charT delim=charT('"'), charT escape=charT('\\'));
41454145
}
41464146
\end{codeblock}
41474147

@@ -7164,7 +7164,7 @@
71647164
@\unspec@ quoted(const charT* s, charT delim=charT('"'), charT escape=charT('\\'));
71657165
template <class charT, class traits, class Allocator>
71667166
@\unspec@ quoted(const basic_string<charT, traits, Allocator>& s,
7167-
charT delim=charT('"'), charT escape=charT('\\'));
7167+
@\itcorr@ charT delim=charT('"'), charT escape=charT('\\'));
71687168
\end{itemdecl}
71697169

71707170
\begin{itemdescr}
@@ -7197,7 +7197,7 @@
71977197
\begin{itemdecl}
71987198
template <class charT, class traits, class Allocator>
71997199
@\unspec@ quoted(basic_string<charT, traits, Allocator>& s,
7200-
charT delim=charT('"'), charT escape=charT('\\'));
7200+
@\itcorr@ charT delim=charT('"'), charT escape=charT('\\'));
72017201
\end{itemdecl}
72027202

72037203
\begin{itemdescr}

source/iterators.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3056,7 +3056,7 @@
30563056
typedef input_iterator_tag iterator_category;
30573057
typedef charT value_type;
30583058
typedef typename traits::off_type difference_type;
3059-
typedef @\unspecaligned@ pointer;
3059+
typedef @\unspecnc@ pointer;
30603060
typedef charT reference;
30613061
typedef charT char_type;
30623062
typedef traits traits_type;

source/macros.tex

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,25 @@
205205

206206
\newcommand{\UNSP}[1]{\textit{\texttt{#1}}}
207207
\newcommand{\unspec}{\UNSP{unspecified}}
208-
\newlength{\unspecwidth}
209-
\newcommand{\unspecaligned}{%
210-
\settowidth{\unspecwidth}{xxunspecalignedx}%
211-
\makebox[\unspecwidth][l]{\UNSP{unspecified}}}
208+
\newcommand{\unspecnc}{\textit{\texttt{unspecified}\nocorr}}
212209
\newcommand{\unspecbool}{\UNSP{unspecified-bool-type}}
213210
\newcommand{\seebelow}{\UNSP{see below}}
214211
\newcommand{\unspecuniqtype}{\UNSP{unspecified unique type}}
215212
\newcommand{\unspecalloctype}{\UNSP{unspecified allocator type}}
216213

217214
\newcommand{\EXPLICIT}{\textit{\texttt{EXPLICIT}}}
218215

216+
%% Manual insertion of italic corrections, for aligning in the presence
217+
%% of the above annotations.
218+
\newlength{\itcorrwidth}
219+
\newlength{\itletterwidth}
220+
\newcommand{\itcorr}[1][]{%
221+
\settowidth{\itcorrwidth}{\textit{x\/}}%
222+
\settowidth{\itletterwidth}{\textit{x\nocorr}}%
223+
\addtolength{\itcorrwidth}{-1\itletterwidth}%
224+
\makebox[#1\itcorrwidth]{}%
225+
}
226+
219227
%% Double underscore
220228
\newcommand{\ungap}{\kern.5pt}
221229
\newcommand{\unun}{\_\ungap\_}
@@ -276,6 +284,7 @@
276284
\renewcommand{\term}[1]{\textit{##1}}
277285
\renewcommand{\grammarterm}[1]{\textit{##1}}
278286
}
287+
279288
\lstnewenvironment{codeblock}{\CodeBlockSetup}{}
280289

281290
% A code block in which single-quotes are digit separators

source/numerics.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4707,7 +4707,7 @@
47074707
{
47084708
public:
47094709
// types
4710-
typedef IntType result_type;
4710+
typedef IntType result_type;
47114711
typedef @\textit{unspecified}@ param_type;
47124712

47134713
// constructor and reset functions

source/utilities.tex

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11038,18 +11038,18 @@
1103811038
inline namespace chrono_literals {
1103911039

1104011040
// ~\ref{time.duration.literals}, suffixes for duration literals
11041-
constexpr chrono::hours operator "" h(unsigned long long);
11042-
constexpr chrono::duration<@\unspec@, ratio<3600,1>> operator "" h(long double);
11043-
constexpr chrono::minutes operator "" min(unsigned long long);
11044-
constexpr chrono::duration<@\unspec@, ratio<60,1>> operator "" min(long double);
11045-
constexpr chrono::seconds operator "" s(unsigned long long);
11046-
constexpr chrono::duration<@\unspec@> operator "" s(long double);
11047-
constexpr chrono::milliseconds operator "" ms(unsigned long long);
11048-
constexpr chrono::duration<@\unspec@, milli> operator "" ms(long double);
11049-
constexpr chrono::microseconds operator "" us(unsigned long long);
11050-
constexpr chrono::duration<@\unspec@, micro> operator "" us(long double);
11051-
constexpr chrono::nanoseconds operator "" ns(unsigned long long);
11052-
constexpr chrono::duration<@\unspec@, nano> operator "" ns(long double);
11041+
constexpr chrono::hours operator "" h(unsigned long long);
11042+
constexpr chrono::duration<@\unspec,@ ratio<3600,1>> operator "" h(long double);
11043+
constexpr chrono::minutes operator "" min(unsigned long long);
11044+
constexpr chrono::duration<@\unspec,@ ratio<60,1>> operator "" min(long double);
11045+
constexpr chrono::seconds operator "" s(unsigned long long);
11046+
constexpr chrono::duration<@\unspec@> @\itcorr[-1]@ operator "" s(long double);
11047+
constexpr chrono::milliseconds operator "" ms(unsigned long long);
11048+
constexpr chrono::duration<@\unspec,@ milli> operator "" ms(long double);
11049+
constexpr chrono::microseconds operator "" us(unsigned long long);
11050+
constexpr chrono::duration<@\unspec,@ micro> operator "" us(long double);
11051+
constexpr chrono::nanoseconds operator "" ns(unsigned long long);
11052+
constexpr chrono::duration<@\unspec,@ nano> operator "" ns(long double);
1105311053

1105411054
} // namespace chrono_literals
1105511055
} // namespace literals
@@ -11969,8 +11969,8 @@
1196911969
\exitexample
1197011970

1197111971
\begin{itemdecl}
11972-
constexpr chrono::hours operator "" h(unsigned long long hours);
11973-
constexpr chrono::duration<@\unspec@, ratio<3600,1>> operator "" h(long double hours);
11972+
constexpr chrono::hours operator "" h(unsigned long long hours);
11973+
constexpr chrono::duration<@\unspec,@ ratio<3600,1>> operator "" h(long double hours);
1197411974
\end{itemdecl}
1197511975

1197611976
\begin{itemdescr}
@@ -11980,8 +11980,8 @@
1198011980
\end{itemdescr}
1198111981

1198211982
\begin{itemdecl}
11983-
constexpr chrono::minutes operator "" min(unsigned long long minutes);
11984-
constexpr chrono::duration<@\unspec@, ratio<60,1>> operator "" min(long double minutes);
11983+
constexpr chrono::minutes operator "" min(unsigned long long minutes);
11984+
constexpr chrono::duration<@\unspec,@ ratio<60,1>> operator "" min(long double minutes);
1198511985
\end{itemdecl}
1198611986

1198711987
\begin{itemdescr}
@@ -11991,7 +11991,7 @@
1199111991
\end{itemdescr}
1199211992

1199311993
\begin{itemdecl}
11994-
constexpr chrono::seconds operator "" s(unsigned long long sec);
11994+
constexpr chrono::seconds @\itcorr@ operator "" s(unsigned long long sec);
1199511995
constexpr chrono::duration<@\unspec@> operator "" s(long double sec);
1199611996
\end{itemdecl}
1199711997

@@ -12009,8 +12009,8 @@
1200912009
\end{itemdescr}
1201012010

1201112011
\begin{itemdecl}
12012-
constexpr chrono::milliseconds operator "" ms(unsigned long long msec);
12013-
constexpr chrono::duration<@\unspec@, milli> operator "" ms(long double msec);
12012+
constexpr chrono::milliseconds operator "" ms(unsigned long long msec);
12013+
constexpr chrono::duration<@\unspec,@ milli> operator "" ms(long double msec);
1201412014
\end{itemdecl}
1201512015

1201612016
\begin{itemdescr}
@@ -12020,8 +12020,8 @@
1202012020
\end{itemdescr}
1202112021

1202212022
\begin{itemdecl}
12023-
constexpr chrono::microseconds operator "" us(unsigned long long usec);
12024-
constexpr chrono::duration<@\unspec@, micro> operator "" us(long double usec);
12023+
constexpr chrono::microseconds operator "" us(unsigned long long usec);
12024+
constexpr chrono::duration<@\unspec,@ micro> operator "" us(long double usec);
1202512025
\end{itemdecl}
1202612026

1202712027
\begin{itemdescr}
@@ -12031,8 +12031,8 @@
1203112031
\end{itemdescr}
1203212032

1203312033
\begin{itemdecl}
12034-
constexpr chrono::nanoseconds operator "" ns(unsigned long long nsec);
12035-
constexpr chrono::duration<@\unspec@, nano> operator "" ns(long double nsec);
12034+
constexpr chrono::nanoseconds operator "" ns(unsigned long long nsec);
12035+
constexpr chrono::duration<@\unspec,@ nano> operator "" ns(long double nsec);
1203612036
\end{itemdecl}
1203712037

1203812038
\begin{itemdescr}
@@ -12430,11 +12430,11 @@
1243012430
\begin{codeblock}
1243112431
class system_clock {
1243212432
public:
12433-
typedef @\seebelow@ rep;
12434-
typedef ratio<@\unspec@, @\unspec@> period;
12435-
typedef chrono::duration<rep, period> duration;
12436-
typedef chrono::time_point<system_clock> time_point;
12437-
static constexpr bool is_steady = @\unspec;@
12433+
typedef @\seebelow@ @\itcorr[-1]@ rep;
12434+
typedef ratio<@\unspecnc,@ @\unspec{}@> @\itcorr[-1]@ period;
12435+
typedef chrono::duration<rep, period> duration;
12436+
typedef chrono::time_point<system_clock> time_point;
12437+
static constexpr bool is_steady = @\unspec;@
1243812438

1243912439
static time_point now() noexcept;
1244012440

@@ -12496,11 +12496,11 @@
1249612496
\begin{codeblock}
1249712497
class steady_clock {
1249812498
public:
12499-
typedef @\unspec@ rep;
12500-
typedef ratio<@\unspec@, @\unspec@> period;
12501-
typedef chrono::duration<rep, period> duration;
12502-
typedef chrono::time_point<@\unspec,@ duration> time_point;
12503-
static constexpr bool is_steady = true;
12499+
typedef @\unspec{}@ @\itcorr[-1]@ rep;
12500+
typedef ratio<@\unspecnc,@ @\unspec{}@> @\itcorr[-1]@ period;
12501+
typedef chrono::duration<rep, period> duration;
12502+
typedef chrono::time_point<@\unspecnc,@ duration> time_point;
12503+
static constexpr bool is_steady = true;
1250412504

1250512505
static time_point now() noexcept;
1250612506
};
@@ -12516,11 +12516,11 @@
1251612516
\begin{codeblock}
1251712517
class high_resolution_clock {
1251812518
public:
12519-
typedef @\unspec@ rep;
12520-
typedef ratio<@\unspec@, @\unspec@> period;
12521-
typedef chrono::duration<rep, period> duration;
12522-
typedef chrono::time_point<@\unspec@, duration> time_point;
12523-
static constexpr bool is_steady = @\unspec@;
12519+
typedef @\unspec{}@ @\itcorr[-1]@ rep;
12520+
typedef ratio<@\unspecnc,@ @\unspec{}@> @\itcorr[-1]@ period;
12521+
typedef chrono::duration<rep, period> duration;
12522+
typedef chrono::time_point<@\unspecnc,@ duration> time_point;
12523+
static constexpr bool is_steady = @\unspec@;
1252412524

1252512525
static time_point now() noexcept;
1252612526
};

0 commit comments

Comments
 (0)