Hot answers tagged

14

Here's a enumitem way and a patch that starts \( after item and ends \) before \item or at the end of the environment, checking with \ifmmode whether we are in math mode or not. Note: \item[...] is not catched here! -- Since the patch is inside the environment group, all other \item definitions in other environments are not changed. It's possible to jump ...


7

You can create a command like \mathitem that you would use in place of \item when you want that the current item contains only math: \newcommand\mathitem[1]{\item $#1$} Your lists will look like this: \begin{itemize} \mathitem{1+1=2} \mathitem{e^{i\pi}+1=0} \end{itemize}


7

Here's a LuaLaTeX-based solution, which works with both enumerate and itemize environments. It does not actually modify the enumerate and itemize environments, it doesn't modify the \item macro, and it doesn't require the use of a new macro called, say, \mathitem. How does the solution work, then? It takes a preprocessor approach: It sets up a Lua function ...


4

Without using any extra packages, just redefine \theenumii, \labelenumi and \labelenumii: \documentclass{article} \renewcommand{\theenumii}{\theenumi.\arabic{enumii}} \renewcommand{\labelenumi}{\theenumi)} \renewcommand{\labelenumii}{\theenumii)} \begin{document} \begin{enumerate} \item Firat item \item Second item ...


3

You can disable the spacing with the nosep option from enumitem. I add also some ways to improve your table, for instance how to make it into filling the whole text width without guessing. Note that the center environment should not be used; also it's better if the \label sits next to the \caption, for easier lookup. I recommend using siunitx for units and ...


3

Unclear, what is meant really, I applied leftmargin=* here: \documentclass[paper=a4, fontsize=11pt]{scrartcl} % A4 paper and 11pt font size \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{enumitem} \begin{document} \noindent Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text ...


3

See, if the following code gives what you expect: \documentclass[12pt]{report} \usepackage[left=35mm, right=25mm, top=30mm, bottom=30mm]{geometry} \usepackage{booktabs,tabularx} \usepackage{siunitx} \begin{document} \begin{table}[htbp] \centering \caption{Systematic review of type 2 vs. type 1 diabetic pregnancies: maternal and fetal secondary ...


3

With version 0.11 of tasks it is possible to say item-format=\ensuremath: \documentclass{article} \usepackage{tasks}[2016/05/03] % v0.11 \begin{document} This is some text. \begin{tasks}[item-format=\ensuremath] \task x + y = z \task e^{i\pi} + 1 = 0 \end{tasks} This is some text. \begin{tasks}[style=enumerate,item-format=\ensuremath] \task x + y = z ...


2

Instead of juggling with \addtocounter{enumi} etc it's better to use enumitem and it's start=... option. The \getrefnumber{...} macro from refcount provides an aid to get the real 'number' of an reference -- \ref isn't expandable and will fail here. Please note: \getrefnumber{...} will yield anything as equation number here, i.e. something 1.A.5 would be ...


2

You can create a command that acts like \item[description title]: \newcommand\descitem[1]{\item{\bfseries #1}\\} You can remove the \\ if you don’t want a line break. The style of the title is easy to change. Your enumerate environment will look like: \begin{enumerate} \descitem{Apples} Apples are red, and contain iron. \descitem{Bananas} Bananas ...


2

An intermediate version with automatic \item usage and the \toplevel* command wrapper, that ignores \sublevel commands then. \documentclass{article} \usepackage{environ} \usepackage{enumitem} \usepackage{xparse} \newif\ifsublevels \sublevelstrue \ExplSyntaxOn \NewDocumentCommand{\sublevel}{m}{% \ifsublevels \seq_set_from_clist:Nn \l_tmpa_seq {#1} ...


2

The internal \theH<counter> is already explained by Christian Hupfer's answer. The answer also shows, how to fix it in a general way. In this case, there is an alternative way. hyperref refines \@addtoreset, which is used by \counterwithin and \numberwithin to support \theH<counter>. However, if these commands are used before hyperref is loaded, ...


2

The enumeration is strange here, therefore I use a new list named strangenumerate Since label*= cannot be applied here for the deeper nested levels (it prints a ), there are some other strategies: Make a conditional on the level of nesting and change the label according to this Refer directly to the counter of the current level, i.e. strangenumeratei ...


2

Here are 3 possibilities: \documentclass[paper=a4, fontsize=11pt]{scrartcl} % A4 paper and 11pt font size \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{enumitem} \begin{document} \noindent Some text Some text Some text Some text Some text Some text Some text Some text Some text Some text \begin{enumerate} [label=Step ...


1

Here's expl3 using a \seq variable and splitting the content of the \commandkey{im} macro into sequence items, then looping over those items using a map function, say \loopfunction Basically any loop macro that can split the comma separated value list would do of course. From the documentation of keycommand it's apparent, that this packages uses etoolbox, ...


1

The checkbox names, in this case, are given by test1, test2 and test3. \documentclass[11pt, letterpaper]{article} \usepackage{enumitem} \usepackage{hyperref} \begin{document} \begin{Form} \begin{enumerate}[label = {\CheckBox[name=test\theenumi]{}} \arabic*:] \item Some item 1 \begin{enumerate}[label = (\arabic*)] \item Some subitem ...


1

I suggest defining a special environment for this application, which gives you more freedom for choosing what to show. \documentclass[10pt, letterpaper]{article} \usepackage{enumitem} \usepackage{environ} \makeatletter \newenvironment{overview}[1] {\begin{enumerate}\relax \ifnum#1=0 \let\do@suboverview\@gobble \else ...


1

Here is a solution (a trick) \documentclass[10pt, letterpaper]{article} \usepackage{enumitem} \usepackage{etoolbox} \newcounter{mt} \BeforeBeginEnvironment{enumerate}{\stepcounter{mt}\setbox\themt\vbox\bgroup} \AfterEndEnvironment{enumerate}{\egroup\ifnum\value{mt}=1\unvbox1\fi\addtocounter{mt}{-1}} \begin{document} \begin{enumerate} \item Overview ...


1

\documentclass{article} \usepackage{kantlipsum} \begin{document} \kant[1] \begin{itemize} \item first \hrulefill \item second \end{itemize} \end{document}


1

First, the body of \foreach is in a group so the effect of local commands is restricted to a single iteration. What it means for your first example is that \toggletrue/\togglefalse only have an effect within the same iteration. To fix this, as suggested in the etoolbox manual, you can prefix them with \global which extends their effect beyond groups: ...


1

Here is a quick try with Tikz: \documentclass{standalone} \usepackage{tikz} \newenvironment{itemizewithline}[3]{% \newcommand{\itemwithline}[1]{% \begin{tikzpicture} \node (box){% \begin{minipage}{\textwidth} \item ##1 \end{minipage} }; ...



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