Hot answers tagged punctuation
21
A package? The following simple macro does it:
\documentclass{article}
\newcount\smcount
\def\smart#1{\ifcase\smcount(\or[\or\{\else TOO DEEP!\fi%
\advance\smcount by1 #1\ifcase\smcount\or)\or]\or\}\else TOO DEEP!\fi%
\advance\smcount by-1 }
\begin{document}
\smart{Ala \smart{ma \smart {kota}}}
\end{document}
(Or, if you wish, not \smart but ...
19
For comparison I am posting a ConTeXt solution.
Such a macro already exists, albeit for quotes. One of the good things about ConTeXt is that a feature is never defined in a one-off basis. For example, instead of defining a macro for quotations that changes the quote symbol depending on the level of nesting, ConTeXt defines a generic delimitedtext mechanism ...
16
Here is an approach which is somewhat more modular than alexurba's approach, which accomodates indefinite levels of nesting.
\makeatletter
\def\@enparen#1{\bgroup\let\enparen\@@enparen(#1)\egroup}
\def\@@enparen#1{\bgroup\let\enparen\@@@enparen[#1]\egroup}
\def\@@@enparen#1{\bgroup\let\enparen\@enparen\{#1\}\egroup}
\let\enparen\@enparen
...
13
Maybe nested definitions:
\documentclass{article}
\newcommand{\enparent}[1]{{%
\def\enparent##1{{\def\enparent####1{\{####1\}}[##1]}}(#1)%
}}
\begin{document}
\noindent
\enparent{My outer layer \enparent{my inner lever \enparent{my innermost level}}}\\
\enparent{My outer layer \enparent{my inner lever \enparent{my innermost level}}}
\end{document}
7
There are some subtleties in this kind of sentences.
You have to decide whether the space in something like "p and q belong to N" you want a normal space after the comma or not and then be coherent across the document. So you can do either
$p$,~$q\in N$
or
$p,q\in N$
In the first form the tie is necessary, or you may get
p,<line break>q ∈ N
...
7
the behavior is inherited from ams-tex -- but there's a particular "understanding" in ams-tex that hasn't been inherited.
ams-tex assumes that \ldots will be used only in text, and then (quoting from internal documentation that is not distributed publicly)
In text, we want to ignore spaces before \dots, and we want to leave
an extra thin space if the ...
7
It's not a "known problem" It is a pretty explicit design aim. The code for \dotsc has
\ifx\@let@token;\@ldots\,
that is it tests for a following ; and adds a thin space \,
Sadly I suspect the reasons for that choice are somewhat lost in time (unless Barbara appears with a rationale)
6
This depends on the font, If I use SimSun (as I had used it in a previous answer) I see no gap if I use the input you show (2 em dashes) I do see a gap if I use the classic TeX input ------ Unicode 6.1 introduces U+2E3A (TWO-EM DASH) but that might be a bit new to be in commonly distributed fonts, I get no visible character in that slot). Sorry about the ...
6
Add \@ to the definition of your custom macro. See When should I use intersentence spacing (`\@')? for details.
\documentclass{article}
\usepackage{xspace}
\newcommand{\origeg}{\emph{e.g.}\xspace}
\newcommand{\eg}{\emph{e.g.}\@\xspace}
\begin{document}
Some text \origeg and some more
Some text \eg and some more
\end{document}
5
you can treat the alignment as an array, and use \hdotsfor (defined by amsmath):
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begingroup
\setlength{\arraycolsep}{0pt}
\begin{equation*}
\begin{array}{rl}
a_0\varphi_0(x_0)+a_1\varphi_1(x_0)+\ldots+a_n\varphi_n(x_0)&{}=f_0\\
...
4
The command \CJKnumber has an argument that should expand to a number, so that it can be converted to the Chinese system.
Thus \CJKnumber{1} is legal, as it is \CJKnumber{\thechapter}: the whole lot is "the number".
Since you want the punctuation mark after the number, the construction
\CJKnumber{\thechapter}、
is what you're looking for.
You probably ...
4
You can achieve advantages of both (readability and good appearance) using Unicode Character 'HORIZONTAL ELLIPSIS' (U+2026)
If you have installed AutoHotKey use following script to convert ... to … automatically:
::...::…
In Windows, it can be inserted with Alt+0133.
In MacOS, it can be inserted with ⌥ Opt+; (on an English language
keyboard).
...
4
Your drivers make use of \newunitpunct instead of \labelnamepunct, so you can't incorporate different unit punctuation after the author-year label. Instead of re-writing the drivers entirely, you might prefer to tailor the standard drivers. This task is made particularly easy with egreg's xpatch package, which (among other things) extends etoolbox's patching ...
4
This is an option:
\documentclass[a4paper,12pt,twoside]{article}
\usepackage{amsmath,amssymb,amsthm,amssymb}
\begin{document}
\begin{displaymath}
\begin{array}{*{3}{c@{\;+\:}}c@{\;=\;}c}
a_{1,1}x_{1} & a_{1,2}x_{2} & \cdots & a_{1,n}x_{n} & b_1 \\
a_{2,1}x_{1} & a_{2,2}x_{2} & \cdots & a_{2,n}x_{n} & b_2 \\
...
3
I would suggest you use the siunitx package and set the comma as decimal point by \sisetup{output-decimal-marker = {,}}.
Using this package will also allow you to use some other very nice features that you'll find handy, such as 3-number separators, SI units, D columns (when dealing with tables full of numbers) and much more!
Take a look at the siunitx ...
3
EDITED ANSWER AFTER COMMENTS
The period at the end of a reference is inserted by the bibmacro finentry, which is the last instruction of standard biblatex entry drivers. One of the thing finenty does is to print the final period using \finentrypunct.
Thus to avoid to print the period at the end one has to redefine it:
...
2
Besides the feature to replace double quotes with their TeX companions (e.g. `` and '') or their Unicode equivalents which is only available in the SVN version, you can use User Macros. Single Quotes can currently only be replaced by them.
Overview:
Trigger LaTeX Content/Tag
(?<=\s|^)" “
(?<=\S)" ”
...
2
Just add an empty group between the two hyphens:
\begin{center}
\begin{tabular}[]{llcl}
\hline
\rowcolor[gray]{.9}\textbf{Parameter} & \textbf{Description} \\\hline
-c, -{}-create & Do something\\\hline
\end{tabular}
\end{center}
Thank you lockstep for you answer!
1
It is actually recommended in the TeXbook by Knuth that you split "list" formulas across commas. Thus, he suggests you write
$a$, $b$, or $z \in S$
rather than
$a, b$, or $z \in S$
specifically because it allows line breaks, whereas math formulas never break after commas for fear of breaking an "argument list" $f(a,b,\dots,z)$. He also recommends a ...
1
Here's a solution using TikZ with your settings. Simply put some marks at the start and ending of the previous line and then use \mdotteline for those marks:
\documentclass[a4paper,12pt,twoside]{article}
\usepackage{amsmath,amssymb,amsthm,amssymb}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand\tikzmark[1]{%
\tikz[remember picture,overlay]\coordinate ...
1
How to draw a line of dots in tikz
shows how to draw such a line. Maybe another alternative would be to use hdashrule from the dashrule package?
\intertext{\hdashrule{8cm}{1pt}{1mm 1mm}}
instead of the tikzpicture may be good enough but still requires a hard-coded width.
1
This behavior is hardcoded in your bibliography style ieeetr. The relevant function is
FUNCTION {format.title}
{ title empty$
{ "" }
{ "``" title "t" change.case$ * ",''" * }
if$
}
If you change that into
FUNCTION {format.title}
{ title empty$
{ "" }
{ "``" title "t" change.case$ * "''," * } %% moved comma out
if$
}
you get the ...
1
You SHOULD read the document of ctex package and follow it. Don't use the low level macros. titlesec is useful for more complex chapter title formats, but it is overkill here.
And further more, CJKnumber option is now somewhat obsolete for new documents, since zhnumber works better than old CJKNumb package. New version of ctex uses zhnumber internally as ...
Only top voted, non community-wiki answers of a minimum length are eligible