There are a few reasons why defining document commands has always been done using the control sequence for the command (\foo
) rather than the control sequence name (foo
). Of course, some of this comes down to 'you'd have to ask Leslie Lamport or Don Knuth', as it follows from the TeX basics. (For example, \newcommand\foo
mirrors \def\foo
, and \DeclareDocumentCommand\foo
mirrors \cs_new:Npn \foo
.)
First, there is an intrinsic consistency for requiring that the 'appearance' at the point of definition is the same as that at point of use.
Secondly, requiring that a token is construction avoids confusion about what can usually appear in a command name. For example, if you did
\declare{foo-bar}...
\foo-bar
the latter would not work (assuming standard LaTeX category codes) as TeX would 'see' the token \foo
followed by a hyphen and the letters b
, a
and r
. That looks like a good way to have problems.
Third, the current set up allows 'experts' to skip the {
... }
pair
\newcommand\foo{definition}
works in the same way as
\newcommand{\foo}{definition}
something that was important when TeX was 'smaller' (we save two tokens there), but also something that many people find easier to read. (Moreover, as most good editors highlight LaTeX tokens differently from 'running text', using a token-based approach works better with many editors.)
Related to that, you have to remember that the current interface was designed in the 1980s based on a system developed in the late 1970s. The additional work for both \csname
expansion and storage of tokens (separate letters rather than a control sequence) was much more important in the past than it is today.
Finally, if you look at the LaTeX3 stuff we want to avoid 'dynamic' definitions as far as possible at the document interface level. One of the lessons of LaTeX2.09/LaTeX2e is that a clearly defined interface is a good thing: encouraging the use of dynamic names does not help there.
It is due to the \topsep
as the bibliography is typeset as a list. If you make \topsep
and \partopsep
zero, then the problem is solved. Taking egreg's code and adding \setlength{\topsep}{0pt}
and \setlength{partopsep}{0pt}
in the re-definition of thebibliography
removes the extra space.
\documentclass[11pt,a4paper]{article}
\makeatletter
\renewenvironment{thebibliography}[1]
{\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth
\setlength{\topsep}{0pt} %%<--- here.
\setlength{\partopsep}{0pt}
\advance\leftmargin\labelsep
\@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode`\.\@m}
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\endlist}
\makeatother % let's get rid of the caption 'References'
\usepackage{bibunits}
\usepackage{paracol}
\setcolumnwidth{3cm,10cm} % column widths
\begin{document}
\noindent\textbf{Published articles}
\par\begin{paracol}{2}
\noindent peer-reviewed\\journals
\switchcolumn
\begin{bibunit}\nocite{*}\putbib[pub]\end{bibunit}
\end{paracol}
\end{document}
Here is a stab using tcolorbox
as an added bonus:
\documentclass[11pt,a4paper]{article}
\def\section*#1{} % let's get rid of the caption 'References'
\usepackage{bibunits}
\usepackage[many]{tcolorbox}
\tcbuselibrary{skins,breakable}
\newtcolorbox{mycolumn}[1][]{
colback=white,
left=0.5ex,
top=0pt,
arc=0pt,
outer arc=0pt,
enlarge left by=1in,
enlarge right by=-\dimexpr1in+\parindent\relax,
right=\dimexpr1in\relax,
leftrule=0pt,
rightrule=0pt,
toprule=0pt,
bottomrule=0pt,
breakable,
nobeforeafter,
enhanced jigsaw,
overlay={
\node[anchor=north east,inner sep=0pt,align=left,text width=1in]
at ([yshift=-1.5ex]frame.north west) {#1};
},
before=\vskip\itemsep\noindent
}
\begin{document}
\noindent\textbf{Published articles}
\begin{mycolumn}[peer-reviewed\\journals]
\begin{bibunit}
\nocite{*}
\putbib[xampl]
\end{bibunit}
\end{mycolumn}
\end{document}
Adjust all instances 1in
in the definition of mucolumn
suitably. Advantage with tcolorbox
is one can go fancy with colors and border rules.
Best Answer
I would strongly recommend against this, but it can be done. The command
\
is a primitive meaning 'a normal space' so shows up in various places, in particular the definition of\nonbreakspace
. Thus a 'safe' redefinition of\
must at least deal with that:I've commented out
\let\ ~
in the preamble in the above so that the demo shows the effect of the change, but in a real case you'd apply it to everything. As pointed out by others, you really should use the correct mark-up to differentiate between a 'forced' normal space and a non-breaking space.