Tag Info

New answers tagged

2

Adding \let\linenumbers\nolinenumbers\nolinenumbers as the last line of the preamble disables \linenumbers (by pointing it instead to \nolinenumbers) and then sets the default mode to \nolinenumbers. This will allow one to retain all the invocations of \linenumbers in all the (sub-)documents...but they will just be ignored. ...


0

There are two reasons why the sixth mandatory argument is not evaluated to empty; I'll reformat the code for better reading. Your code can be equivalently written \cventry{year--year} {THIS IS JUSTIFIED, AS YOU CAN PLAINLY SEE} {THIS IS ALSO JUSTIFIED} {THIS IS JUSTIFIED, TOO} {AND THIS IS JUSTIFIED AS WELL} { \ifdetails I would like all ...


2

The condition for checking an empty argument within moderncv's \cventry is not appropriate. Here's the definition: \renewcommand*{\cventry}[7][.25em]{% \cvitem[#1]{#2}{% {\bfseries#3}% \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}% \ifthenelse{\equal{#5}{}}{}{, #5}% \ifthenelse{\equal{#6}{}}{}{, #6}% .\strut% \ifx&#7&% ...


5

Use the ifluatex package. \documentclass{article} \usepackage{ifluatex} \begin{document} \ifluatex hello \else goodbye \fi \end{document}


0

One could use the assoccnt package where you can associate a counter with some other master counter, stepping it in tandem. At the end of the document, you write out a \label that would capture the existing total count of the associated counter. Then, using refcount's expandable \getrefnumber, a conditional LoF (or other Table of Contents structure) could be ...


6

That is an interesting question indeed. I am always very wary of automatic solutions, they do exactly what they are told and are not intelligent. And one always has to check if everything went exactly as planned manually anyway. With Biber we can do regex checks on fields. Regex allows to check for Cyrillic characters. Here we check the title field (the ...


3

\bool_if:NT \l_sectioning_numbered_bool { \thesection.\ } \bool_if:NTF \l_sectioning_lowercase_bool { \tl_lower_case:n } { \tl_upper_case:n } { #1 } In that case, I think that would be enough. May be clearer is \bool_if:NT \l_sectioning_numbered_bool { \thesection.\ } \bool_if:NTF \l_sectioning_lowercase_bool { \tl_lower_case:n { #1 } } { ...


1

The syntax is wrong: you're probably used to C or something like that. TeX conditionals are always in the format \if<name><test> <true text> \else <false text> \fi with no braces around the two cases. Well, braces can be used, but they will group the tokens inside them, which usually is not wanted. In general loading a package ...


1

The following example remembers the section count in the .aux file. A counter abs@chapter is used to identify the chapter. Thus also starred or unnumbered chapters are supported. \section is redefined to write a line in the .aux file, which increases the number of sections for the current chapter. Also starred \section commands are supported. In the next ...


1

This is a quick solution with the cntperchap package (I am quite familar with its author ;-)) The key is to register counters which should be tracked on a per chapter base, here it is the section counter. Then use the \GetStoredCounterValue[chapter number]{section} macro to get the number of sections in the relevant chapter. This does not print the number ...


4

Two problems: You are using three conditionals but have only two closing \fi's. Use of the conditionals should be performed in the traditional way: \if.. <true> \else <false> \fi Note there is not grouping of the <true> and/or <false> clause. That's the main problem in your case, as definitions are then made local to that ...


2

You don't need the test for numeric, in my opinion. I suggest a different syntax: \der[<function>]{<variable>}[<order>] with two optional arguments; if you omit the first, you get the operator, otherwise the derivative; the second argument is the order of derivation. With xparse it's easy to do it; the first optional argument has empty ...


2

I think you want something like this (which actually tests for a sequence of digits resulting in >0 so don't use [000] ;-) \documentclass{article} \newcommand{\diff}[1][]{% \def\ArgI{#1}% \diffRelay% } \def\eatrelax#1\relax{} \newcommand{\diffRelay}[2][]{% \expandafter\eatrelax\ifnum0=0\ArgI\relax% is numerical % better: \and #1 is empty ...


10

Package xcolor can extract the color definition in a macro: \extractcolorspec{<color>}{<macro>}. This can be used to define a test to compare the current color . with red: \documentclass[a4paper,12pt]{article} \usepackage[T1]{fontenc} \usepackage[svgnames]{xcolor} \usepackage[scaled=0.84]{beramono} \makeatletter \newcommand{\MyChange}[1]{% ...


5

You can use the fact that a color's definition is kept in the macro \csname\string\color@<colorname>\endcsname and you can inspect the current color with . for <colorname>, as explained in http://tex.stackexchange.com/a/36163/4427 \documentclass[a4paper,12pt]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} ...


4

All the file input tests use \input@path as well as the standard TEXINPUTS variable, personally I find it easier to just set TEXINPUTS rather than use \input@path (\graphicspath just sets a version of \input@path used locally during the scope of \includegraphics) However if you want to use the macro directory list for all such operations, replace ...


3

You can also give the langid field in addition to setting autolang to a sensible value. Unfortunately, the mapping to the language is a bit picky and does not work with XeLaTeX (an utf8 aware engine) out of the box. \begin{filecontents}{\jobname.bib} @online{someotherentry, url={texwelt.de}, urldate={2015-05-11}, author={a ...


4

This is most definitely not a complete answer but you could try adding the babel=other option when loading biblatex and supplying the Russian-language entries with something like hyphenation = russian. Whether there is a way of automating this latter operation is still an open question.


1

This is what macros are for. ;-) \documentclass{report} \usepackage[paperwidth=8cm,paperheight=13cm]{geometry} \usepackage{xcolor} \usepackage{sectsty} \newcommand{\currentscheme}{% \definecolor{belux}{HTML}{3366FF}% \definecolor{underbelux}{HTML}{4477EE}% } \newcommand{\orangescheme}{% \definecolor{belux}{RGB}{189,79,0}% ...


3

I would approach this problem using a key-value interface to do most of the heavy lifting. The advantages of this method are that you can define new schemes anywhere, and a single document can use more than one scheme if desired (respecting grouping/scope). There are several keyval packages, and the code can get even more fancy than what I show below, but ...


1

I'm putting this as an answer despite it's brevity. Sometimes the least convoluted thing is the best thing, and the most extensible thing. I would just create a set of files, one for each scheme. In each file define the colors you want. Then just include a line in your file \input{colorschemepurple.tex}


3

As is explained in page 1 from comment documentation, you can define as much as commentable environments as you want, just include \includecomment{name of environment} or \excludecomment{name of environment} to select or unselect corresponding lines in your document. With them you can declare environments for any color combination \begin{orange} %orange ...


4

I just realized there is another easy solution. The xstring package has starred versions of its comparison commands that do not take category codes into account. All that is necessary to make the file work is to replace \IfStrEq by \IfStrEq*.


6

The \jobname primitive is a TeX string, so all characters have category code 12 (other) not 11 (letter) (with the exception of any spaces, which are category code 10 (space)). Slightly confusingly, xstring is carrying out a token-based comparison here not a string one! Assuming e-TeX is available you can fix your code easily \documentclass{article} ...


2

since you want only a word or so omitted, i think an ordinary command is better than an environment. here's one possibility. \documentclass{article} \newif\ifmycmd \newcommand{\FlagText}[1]{% \ifhmode\unskip\fi \ifmycmd \else \space #1\fi } \begin{document} Here is some text \FlagText{with some words} to be ignored. \FlagText{Start} a new ...


3

You shouldn't use @ in command names, when using ConTeXt; but you should be aware of the fact that ConTeXt uses Unicode math, so the standard math code of the hyphen cannot be accessed to with \mathcode. \begingroup \catcode`\"=12 \catcode`\`=12 % added a safe setting for the backquote \gdef\newmcodes{\mathcode`\'39\mathcode`\*42\mathcode`\."613A ...


3

You need to perform a string comparison with the expansion of \@currenvir against itemize. \ifthenelse with the \equal operator does this, but you're short a magic \makeatletter...\makeatother wrapper (see What do \makeatletter and \makeatother do?). Consider the post Why is the ifthen package obsolete?, I've used the e-TeX \pdfstrcmp to perform a string ...



Top 50 recent answers are included