# Tag Info

0

The following does with horizontal and vertical leaders. Drawbacks: Page-breaks are not possible. As the dotted lines are drawn as vertical leaders, vertical skips in the left side other than \baselineskip are not taken into account. \documentclass[12pt]{book} \usepackage[paperwidth=21cm,paperheight=29.7cm,top=2.5cm,bottom=2cm,left=2cm,right=1.5cm]{...

1

It's easy with expl3: \documentclass{article} \ExplSyntaxOn \seq_new:N \g_mrclng_coeffs_seq \NewDocumentCommand{\coeff}{m} { \seq_if_in:NnF \g_mrclng_coeffs_seq { $#1$ } { \seq_gput_right:Nn \g_mrclng_coeffs_seq { $#1$ } } c\sb{#1} } \NewDocumentCommand{\printcoeffs}{} { \seq_use:Nn \g_mrclng_coeffs_seq {,~} } \ExplSyntaxOff \begin{...

0

There are many ways to do it. Here's a simple one using minipage: \documentclass[12pt]{book} \begin{document} \begin{minipage}[t]{\linewidth} \begin{minipage}[t]{0.4\linewidth} \textbf{Example 1.} Lorem ipsum dolor sit amet consectetuer Proin Curabitur condimentum vel Vivamus. Cursus dui vitae et facilisis Mauris sociis ...

0

I recently implemented this in my own thesis based on answer provided by @egreg. However, I realized that referring back to a specific page will be a bother for most people. Thus I implemented it in a way that each page has two different numbers in it. I have Arabic numerals at the top right/left (for odd/even numbered pages) (based on answer to this post) ...

0

Although you don’t say what you’re trying to do, you might have an XY-problem. That is, if your actual goal here is to be able to display Assamese numerals that show as ASCII digits in your source, there are simpler ways to do it. This works in LuaLaTeX: \documentclass{article} \tracinglostchars=3 % Halt if a font cannot display a glyph. \usepackage[...

0

You have to localize the font change: \def\mapcommand#1{{\mapfnt\xxconvert#1@}}% <-- add braces! You can also consider this simpler implementation: \documentclass{article} \usepackage{fontspec} \setmainfont{Times New Roman} \newfontface\mapfnt{Charis SIL} \ExplSyntaxOn \NewDocumentCommand{\conversiontable}{m} { \tl_set:Nn \l_israt_convert_table_tl {...

1

You can use also gensymb package or siunitx as this example without to declare a predefinite command named \deg. \documentclass[12pt]{article} \usepackage{amsmath} \usepackage{siunitx} \usepackage{gensymb} \begin{document} Your angle is \ang{350} (siunitx package) or 350{\degree} (gensymb package). \end{document} The MWE work also in math-mode: $\ang{350}$,...

1


1

Sorry to be late to the party. Anyway, the g and G argument specifiers are deprecated. The most natural syntax is \Set{A} or \Set{A | B} which is even easier to type than $\Set{A}{B}$. \documentclass{article} \NewDocumentCommand{\Set}{ >{\SplitArgument{1}{|}}m }{\SetAux#1} \NewDocumentCommand{\SetAux}{mm}{% \bigl\{% #1% \IfValueT{#2}{\bigm|#2}% \...

0

You can create two macros with the different parameter counts (and name) and invoke them within a composite macro with the desired name. Inside the new macro, call one of the two macros based on the number of parameters passed using \IfNoValueTF. \documentclass{article} %Import xparse for \IfNoValueTF \usepackage{xparse} %Define behavior of the command ...

1

A bit off-topic, however: Fahrenheit are not standard unit, instead it is correct to use Celsius degrees. If you for some reason persist to use it, than is sensible to define them as part od siunitx package: \documentclass{article} \usepackage{siunitx} % <--- \DeclareSIUnit{\fahrenheit}{^\circ\mkern-1mu\mathrm{F}} % <--- \begin{document} ...

3

With \newcommand, I get ! LaTeX Error: Command \deg already defined. Or name \end... illegal, see p.192 of the manual. which I'm assuming you ignored when running with that version of the command. \deg is one of the text operator symbols provided by LaTeX. It's used in graph theory to say things like ∑v ∈ V deg(v) = 2|E| When you ran past ...

0

It's very easy with expl3, that's included in the LaTeX kernel since 2020-10-01 (if you have an earlier release you need to add \usepackage{xparse}). \documentclass{article} \ExplSyntaxOn \seq_new:N \l_srour_list_seq \NewDocumentCommand{\addtolist}{mm} { \seq_put_right:Nn \l_srour_list_seq { \item[#1] #2 } } \NewDocumentCommand{\uselist}{} { \...

1


1

The first big problem with the OP code was redefining \list, which is widely used code used to make a variety of lists, such as the description environment. Oops. So I renamed it \llist, so as to leave the list-making \list intact. Then, I also used \g@addto@macro rather than an \edef to build the list items, because I felt it was a safer way to proceed. \...

6

While this sort of mimics the listofitems usage syntax, it allows a different form of input other than a simple list, which can be non-sequential if desired. \documentclass{article} \makeatletter \newcommand\setaside[1]{% \def#1[##1]{% \csname\expandafter\@gobble\string#1[##1]\endcsname}} \def\define#1[#2]#3{% \expandafter\def\csname\expandafter \@...

0


1

If you don't mind your command \classify and your environments bt and vt to have a non-optional argument, then you can use the package zref and have the environments bt and vt place referencing-labels for properties blvd and blbt the command \classify extract values of properties from these referencing-labels: \documentclass[12pt]{article} \usepackage{...

6

Ad question 1: I was wondering if there are any clever workaround for including a number in a custom macro name? I'm working with a platform that integrates LaTeX with a computer algebra system, and frequently have variables such as a[1], a[2] etc that I have to assign to tex commands. Right now, the most functional solution I've found is using Roman ...

1

\documentclass[12pt]{article} \newif\ifblbt \newif\ifblvd \newenvironment{bt} {\blvdfalse\blbttrue{\bfseries\classify\par}} {} \newenvironment{vd} {\blvdtrue\blbtfalse{\bfseries\classify\par}} {} \newcommand\classify{The below environment is \ifblvd Example\else\ifblbt Problem\else Wrong\fi\fi} \begin{document} \begin{bt} Contents PPP \...

4

9

I'm not sure if this solution applies to your needs, since your examples are not precise enough but the listofitems package seems to do the job: \documentclass{article} \usepackage{listofitems} \begin{document} \readlist\f{foo,bar,baz} Now f[1] is \f[1] and f[3] is \f[3]. \end{document}

6

well you shouldn't use \a that is already defined. But beside from this, naturally commands can do different things depending on the argument. If you know your arguments are numbers, you could e.g. get the content from a sequence: \documentclass{article} \ExplSyntaxOn \seq_new:N\l_rax_data_seq \seq_set_from_clist:Nn \l_rax_data_seq {foo,bar,baz} \...

1

As pointed out by Ulrike Fischer in the comments \def \sb {{\bf s}} overwrite thes LaTeX kernel command \sb (defined as \let\sb=_) with a new definition. Because the code uses \def this happens without warning. (If the code had used the LaTeX convention \newcommand there would have been an error message telling us that \sb is already defined.) Unfortunately,...

3

When \maketitle is typesetting the title, it uses \@title. By default, \@title is defined as: \def\@title{\@latex@error{No \noexpand\title given}\@ehc} so the document: \documentclass{article} \begin{document} \maketitle % <-- error here \end{document} will throw the error in \@title. When you do \title{<anything>}, the \title command does: \gdef\...

0

If you want to get the effect of \begin{addmargin}[2em]{0em} \lol{MY TEXT HERE} \end{addmargin} the simplest way to do this is to modify your existing definition of \lol to include the \begin…\end of the enclosing environment. So you would rewrite your definition¹ as: \NewDocumentCommand{\lol}{m}{ \begin{addmargin}[2em]{0em} \vspace{4pt}\color{...

2

This is a longer comment. As I understand it, the first four arguments of \pgfpicture is one way to hard-code the bounding box of the picture. For example, you specify that the bounding box is from (0, 0) to (50pt, 3cm); but your picture actually extends to (10cm, 2cm). So it exceeds the right margin. If, instead, some line goes to (-5cm, 0), then that line ...

2


0

The root cause seemed to be missing makeatletter and makeatother. \makeatletter \newcommand\stars{\@startsection {stars}{1}{\z@}% {-3.5ex \@plus -1ex \@minus -.2ex}% {2.3ex \@plus.2ex}% {\normalfont\Large\bfseries}} \makeatother

2

You want to use an expandable mapping, so \seq_map_function:NN. \documentclass{article} %\usepackage{xparse} % not needed with LaTeX 2020-10-01 or later \usepackage{tabularray} \ExplSyntaxOn \seq_new:N \pb_mytblr_entries_seq \NewDocumentCommand { \entry } { m m m } { \seq_put_right:Nn \pb_mytblr_entries_seq { { #1 } { #2 } { #3 } } } \cs_new:Nn \...

2

[In your examples you did not obey all expl3-conventions for naming control sequences. In my coding-examples I renamed things to fit the conventions.] In your example the \entry-macro is used for accumulating things within a sequence-variable. You use it within the mytblr-environment. At the end of that environment the things stored in the variable are to be ...

2

As Steven B. Segletes already said: The tblr-environment wants to "see" \MyTable expanded. You can achieve this as shown by Steven B. Segletes via temporary macros. Another approach is having two macro-arguments and expanding the first macro-argument before exchanging it with the second one: \begin{filecontents*}{mytable.tex} 1 & 2 \\ ...

Top 50 recent answers are included