Tag Info

Hot answers tagged

5

You can test if the optional argument is empty. How to check if a macro value is empty or will not create text with plain TeX conditionals? gives several possible ways how to do that. I picked one here: \documentclass{article} % traditional solution: \newcommand*\mycommand[2][]{% \if\relax\detokenize{#1}\relax \else #1,\nobreakspace \fi ...


4

You shouldn't be using the german package that's obsolete and present only for compatibility with older documents. However, the problem is present also with babel. I'll add the code for working around the issue. \documentclass{article} \usepackage[ngerman]{babel} \usepackage{libertine} \usepackage{ifxetex} \ifxetex ...


4

To add bullets, you can make the period an active character and define a macro that adds the bullets: \documentclass{article} \begin{document} \begingroup % EDIT \let\origdot=. \catcode`.=\active \def.{\origdot\ensuremath{\bullet}} Hello. I am a sentence. Mr.\@ Black knows too little. \endgroup % EDIT \end{document} This results in: ...


2

Do \usepackage{amsthm} that has an interesting \@addpunct macro and carry the current value of \spacefactor inside the \hbox: \usepackage{amsthm} %Make a dot before the page number \makeatletter \renewcommand*{\cftfigureformatpnum}[1]{% \edef\savespacefactor{\the\spacefactor}% \cftfigureformatpnumhook{#1}% \hbox to \@pnumwidth{% ...


2

It's really easy with xparse: \usepackage{xparse} \NewDocumentCommand{\ocite}{om}{% \IfNoValueTF{#1} {% no optional argument in the input \cite{#2}% } {% optional argument has been given #1,~\cite{#2}% note the tie }% } The list of arguments, instead of being a number, says o for an optional argument without a default ...


1

Here is what works for me. It is based on the following observation: Closing quotes are the ones followed by a space or a punctuation mark, and all other quotes are opening quotes This rule can be implemented using \new@ifnextchar command from amsgen.sty that does not ignore spaces: \usepackage{amsgen} \makeatletter ...


1

I solved this using the xstring package, which includes a good amount of functionality for working with strings. The IfEndWith and StrGobbleRight commands were particularly useful. After including the package, I redefined the caption function with the following: %Renew the caption command \let\oldcaption=\caption \renewcommand{\caption}[1]{% ...


1

The approach of the other answer is certainly better, but heres what I came up with: You want to replace periods, so do just that \documentclass{article} \usepackage{xstring} \begin{document} \section{original tex} %one paragraph from lipsum package Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, %cut that here \section{with ...



Only top voted, non community-wiki answers of a minimum length are eligible