Tag Info

Hot answers tagged

9

I have said that you are inclined to plain TeX code. But your question seemed me to be interesting. So, I tried to do something despite this is LaTeX problem. You can start with experimenting with my code: \newcount\openLnum \newtoks\currtext \def\Open{\let\bgroup=\relax \let\egroup=\relax \currtext{}\checkbracesA} ...


7

An environment forms a group, so a \def inside it will not survive the end of the envvironment. What you need is \gdef, but your \AA is a perfect example of something that shouldn't be done, as \AA is a font related command (it produces Å). You can define your own check, using \@ifdefinable to check for availability of the command and \gdef to globally ...


6

I'd suggest you to use either the mdframed or the tcolorbox packages; both offer you an easy key-value interface to define decorated theorem-like structures that will automatically include numeration (and easy control over the counter used). In the following example code I show a comparison between the environment that Herbert provided in his answer with ...


6

As Paul Gessler has commented, you can put every thing in one tabular environment with two p columns each having a width of >{\raggedright\arraybackslash}p{\dimexpr0.5\textwidth-2\tabcolsep-2\arrayrulewidth\relax} minipages are not needed any way. You can further use enumitem package and its resume option to continue numbering. I have also aligned ...


5

As stated in the Beamer manual v3.33 at the end of page 62, when trying to use a frame environment inside \newenvironment, the ending must end with \end{frame} and not contain any other \end command, since the actual mechanics are somewhat sensitive. So in order to add additional environments, the manual suggests to define a separate new command to contain ...


5

Although \newtheorem is, in fact, similar to \newenvironment, they are different: \newtheorem is specifically designed to define a particular kind of environment: theorem-like structures whereas \newenvironment allows you to define arbitrary environments. A theorem-like structure is one that typically has a head (formed by a name and a number) and a body ...


4

One possibility is to use \aftergroup, as suggested by Christian in his comment. Note that this approach only allows you to "escape" the scope of the foo environment, i.e. one level up; if the foo environment is not at the global scope, the pgfplots settings will not be applied globally. \documentclass{article} \usepackage{pgfplots} ...


4

Specifying the four arguments as a comma-separated list is probably not a good idea: what if an argument contains a comma? Using the regular TeX syntax for passing arguments is preferable. Note that \tn is defined nowhere in your code snippet; I substituted \\ for every occurence of it. \documentclass[12pt]{article} \newcommand\finding[4]{% ...


4

The mystery is readily solved: tabu processes its input twice or more. It disables some commands during the trial processing, but it forgets to do it for \stepcounter and \addtocounter. One of the commands it disables is \write, with the consequence that the \vspace is added but the message is not issued. \documentclass{article} \usepackage{tabu} ...


4

EDITED to remove double appearance of "Figure 1". EDITED again to give the OP a gray box around the caption. EDITED a 3rd time to place repetitive stuff in macros. Use \startfig to open the figure, and \capfig{} to provide the caption and/or label and close it out. Final EDIT to add support for labels. \documentclass{article} ...


4

\documentclass[12pt,twoside,openright,a4paper]{memoir} \newcounter{FrameCnt} \setcounter{FrameCnt}{0} \newcommand{\FrameTitle}[2]{% \fboxrule=\FrameRule \fboxsep=\FrameSep \fbox{\vbox{\nobreak \vskip -0.7\FrameSep \rlap{\strut#1}\nobreak\nointerlineskip% left justified \vskip 0.7\FrameSep \hbox{#2}}}} ...


4

There is another part of the original question: how to map \Open and \Close to the Unicode characters ❴❵ U+2774 and U+2775. If you are using XeTeX or LuaTeX then you can do: \catcode`^^^^2774=13 \let^^^^2774=\Open \catcode`^^^^2775=13 \let^^^^2775=\Close If you are using pdfTeX with encTeX activated (by -enc option when format was generated) then you ...


4

Here is a try with environ package. But I am not sure if it works for your complex cases. It is worth giving a try. The following code works. \documentclass[a4paper]{scrartcl} \usepackage[margin=1in]{geometry} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{ltablex} % includes tabularx, but combined with longtables (spanning multiple ...


3

This is an explanation of the problem rather than a full solution. As Joseph Wright suggested this problem would be much easier to understand with a proper minimal working example. In fact, if you cut down to a MWE then it becomes clear what the problem is: as one might suspect, the xparse package is completely innocent. Here is (close to) a MWE. To save ...


3

This stores the current section counter and restores it after the listing environment. Internally, the section counter is reset for the listings output purposes. \documentclass{article} \usepackage{listings} \usepackage{tcolorbox} \tcbuselibrary{listings}% \usepackage{xcolor} \lstset{ % General setup for the package language={[LaTeX]TeX}, ...


3

I get no error if I replace \end{tabularx} (which is probably wrong in the first place) with \endtabularx\endgroup. No guarantee this won't break anything else. \documentclass[a4paper]{scrartcl} \usepackage[margin=1in]{geometry} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{ltablex} % includes tabularx, but combined with longtables ...


3

You have been warned! I know, many readers will regard this as a comment and not an answer, but the message seems too important to bury it in the digital massgrave of comments below the question: Such a macro \Close obviously may cause very strange effects, while making it impossible to find the cause. Beginners who have troubles with missing \end{some ...


3

I would use the multline* environment, as there's to align naturally: \documentclass[a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[nomarginpar, showframe]{geometry} \usepackage{mathtools} \begin{document} \begin{multline*} \iint_S \eta = \iint_S \left[F(x(u,v), y(u,v), z(u,v)) \frac{\partial(x,y)}{\partial(u,v)} \right. \\\left.{} + ...


3

If you are using theorem-like environments, with \usepackage{amsthm} then you can define them as remark-style or definition-style, like : \theoremstyle{remark} \newtheorem{ex}{Example} As explained in the "Theorem styles" section here.


2

The number within option in the definition of texexptitled has to be set to backupsection or \backupchapter (perhaps better) \documentclass[oneside]{book} \usepackage{listings} \usepackage{tcolorbox} \tcbuselibrary{listings}% \usepackage{xcolor} \usepackage[bookmarks=true, bookmarksopenlevel=2]{hyperref} %Definition of New Environments \tcbset{ ...


2

I propose to put the the structure saving commands into the lower part only. Such, the numbering of the tcolorbox is not affected. To avoid the tocs and bookmarks problems, I suggest to deactivate \addtocontents and \addcontentsline as was done for \documentclass. My answer creates a new option protect structure which contains all this stuff. ...


2

1: Don't use \\ after \mbox{}. 2: The option would be label=(3.\arabic{enumi}), although this is a bit odd, given that the enumerates are not nested. 3: Put \mbox{} after \item[Theorems], not after \begin{enumerate}[leftmargin=*,start=4]


1

You already can do that quite easily with the enumitem package: it has a resume* option that uses the parameters of the preceding list of the same type and level, and, for enumerate, starts the counter where the preceding list had left it. Demo: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{amssymb} \usepackage[svgnames]{xcolor} ...


1

Well, just like an example of what we can do with a package suited for theorems and that stuff, belong your MWE with few additions: \documentclass{book} \usepackage[table]{xcolor} \usepackage{tabularx,booktabs} \usepackage{amsmath,amssymb,latexsym} % necessary for maths \usepackage{ntheorem} % One of the best packages for write theorems, proofs, ...


1

I'm not sure, if I understood your intention completely. But, I corrected the errors Christian Hupfer already mentioned, and I made a new macro \texexptitledinputlisting which hopefully helps for your own extensions. I kept the rest unchanged with small exceptions / corrections. \documentclass{article} \usepackage{xcolor} \usepackage{listings} ...


1

As I just found out, using fragile=singleslide (instead of just fragile) as an argument of frame solves this particular issue too. However, the accepted answer is likely to fix other issues as well and arguably should be the preferred way to do it.


1

You should not break the two parts into two environments: \documentclass{article} \usepackage{xparse} \NewDocumentEnvironment{mquote}{m} {\begin{quote}} {{\interlinepenalty 10000 \brokenpenalty 0 \par}% <--- change to \par, if you like \nopagebreak\makebox[\linewidth][r]{#1}\end{quote}} \setlength\textheight{2cm} \begin{document} \noindent ...


1

This seems to work... Also, if you change the \iffalse to \iftrue, you get back the tabular content. \documentclass{article} \let\svtabular\tabular \let\endsvtabular\endtabular \renewenvironment{tabular} {\setbox0=\vbox\bgroup\svtabular} {\endsvtabular\egroup\iffalse\box0\fi} \begin{document} xxxx \begin{table}[htbp] \centering \caption{my ...


1

You can use the environ package to hide your tabular environments. If you just want to kill off all existing tabular environments then you can simply use: \RenewEnviron{tabular}[2][\relax]{} As I slightly misread you question, below I have also defined an environment Htabular (=hidden tablular) with a default first argument of c. This becomes the layout ...


1

I believe that you just need to switch back to horizontal but perhaps I have missed something... \documentclass{report} \usepackage{CJKutf8, CJKspace} \usepackage[usebaselinestretch]{CJKvert} \usepackage{setspace,rotating} \begin{document} \begin{center} \begin{singlespace} \vspace*{-2cm} \parbox[c][5em][c]{15cm}{% \small In order to properly understand ...



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