Tag Info

New answers tagged

1

Here is a quick demo of linking R and LaTeX using the 'knitr' package. This has been run on Windows 8.1, with MikTeX 2.9, and TeXmaker 4.4.1 as the IDE. The following code is saved as knit02.Rnw (and this is case sensitive). With the package 'knitr' installed in R 3.1.3 you run the command: knit("knit02.Rnw"). This will generate the file 'knit02.tex' ...


3

You can still use a longtable as this: \documentclass[12pt,english,nohyper]{tufte-handout} \usepackage{longtable} \begin{document} \begin{longtable}{cc p{1em} cc} \cline{1-2} \cline{4-5} & vals& & & vals\\ \cline{1-2} \cline{4-5} a & 3.39& & a & 3.39\\ b & 4.35& & b & 4.35\\ c & 6.16& ...


2

The images will only be listed if you give them a caption, if you put them, in table environments the order of the three items will be maintained.


2

What about the following idea? It's much different from yours (or perhaps the class author's), but perhaps more robust as it uses the \label-\ref system to determine whether a page break has occurred mid-question: \documentclass{article} \usepackage[paper=a5paper,margin=1in]{geometry}% Just for this example \usepackage{multido}% Just for this example ...


1

My original idea was to change the footer at the environment start and revert it at the end, but this fails if the environment ends whilst TeX is storing material that will ultimately contain a page break (most likely if the environment end ends up near the top of a page). I think the right way to do this is to put a switch in the footer itself, to detect ...


1

I think I have come pretty close to a real solution. It's not particularly minimal, but it does most of what I hoped to accomplish. Basically this works by redefining line breaks in the source code to hook a counter that increments line by line except inside instructornotes. For the initial student compile, we hook into every shipout to record the line ...


0

Using math-mode characters in the title without the necessary environment can lead to 4 head-scratching errors. Underscores are to be written \_ if used outside of math mode.


0

The titlesec package already does that: write in your preamble: \usepackage[nobottomtitles*]{titlesec} \renewcommand{\bottomtitlespace}{0.25\textheight} If the remaining vertical space on the page is less than 25% if the text height, the page will be raged bottom, and the title will be moved to the next page. See details § 3.3, Spacing related tools, ...


3

Not precisely what the O.P. wants to have (not twocolumn mode and automatically), but parallel with parallel package: \documentclass{article} \usepackage{parallel} \usepackage{mathtools} \usepackage{amsthm} \newtheorem{definition}{Definition} \newtheorem{example}{Example} \begin{document} \begin{Parallel}{0.4\textwidth}{0.4\textwidth} \ParallelLText{% ...


2

It’s a bit sad to see how easily people are inclined to forget the good ol’ ways of doing things… Seriously, this question (like others I have already seen on TeX.SX) looks like a classical problem which is discussed, and solved, on page 111 of The TeXbook, where the \filbreak command is introduced. Quoting from there: The most interesting macro that ...


1

Probably you want \raggedbottom which means that when there's no space for something in a page a new one is open without flushing the contents to align to the bottom. Plus a {minipage} environment (which doesn't break across pages). Just put \raggedbottom in the preamble and use \newcommand\newpageoptional[1] ...


1

\documentclass[paper=A6]{scrartcl} \usepackage{needspace} \usepackage{blindtext} \newsavebox\TBox \newcommand\newpageoptional[1]{% \savebox\TBox{\parbox{\linewidth}{#1}}% to get the height of the text \needspace{\dimexpr\ht\TBox+\dp\TBox}% totalheight #1} \begin{document} \blindtext \newpageoptional{% Text and code 2 with blindtext ...


1

You can add a new key to quoting. Specifying this key should allow page breaks only at explicit paragraphs (blank lines). \documentclass[a4paper]{memoir} \usepackage[indentfirst=false]{quoting} \usepackage{lipsum} \makeatletter \define@key{quo}{nopagebreak}[true]{\interlinepenalty=10000 } \makeatother \raggedbottom \begin{document} \lipsum[1-4] ...


0

A working solution is to put each verse in its own quoting environment, to which one adds the (conveniently global) option vskip=0cm, and which rids one of the necessity to add a manual linebreak at the end of the second half of the verse. \documentclass[a4paper]{memoir} \usepackage{fontspec} \usepackage[indentfirst=false,vskip=0cm]{quoting} ...


1

Try \\* to suppress a page break after a forced line break.


1

You can use the \needspace macro (directly available in memoir, for other classes there's the needspace package). \documentclass[b5paper]{memoir} \usepackage{lipsum} \renewcommand{\clearforchapter}{} \pagestyle{plain} \chapterstyle{default} \renewcommand*{\chapterheadstart}{% \par \needspace{10\onelineskip} \vspace{\beforechapskip} ...


2

Alternative: Use tcolorbox (Gonzalo Medina was proposing it while I wrote this answer ;-)) with the breakable option. There is a huge number of options for the shape, colours etc -- it's impossible to show them all here in a small example. \documentclass{article} \PassOptionsToPackage{svgnames}{xcolor} \usepackage[most]{tcolorbox} \usepackage{blindtext} ...


9

Yes, see the documentation of the buildpage_filter callback, and possibly also the pre_output_filter callback. Note however that unlike the linebreaking algorithm, there are very few parts of the page breaker that you are forced to use directly, which is why different strategies can be programmed even in classic tex without needing lua extensions, such as ...


2

Wrong syntax, please check the documentation of package fancyvrb. The environment name starts with an uppercase letter V and the options are not inbetween, but follow \begin{Verbatim}. \begin{Verbatim}[samepage=true, gobble=4] sc <- read.table("~/pathToData/sc.data.txt", quote="\"", comment.char="") some more code and even more ...


2

Here is a simple solution with the framed option of ntheorem, which has tools for selectively typeset theorem lists: \documentclass{article} \usepackage[english]{babel} \usepackage[margin=2cm]{geometry}% just for the example \usepackage[x11names]{xcolor} \usepackage{lipsum} \usepackage{amsmath} \usepackage[thmmarks, thref, amsmath, framed]{ntheorem} ...


2

Use the mdframed key to interact with the mdframed package and set the margins to the appropriate values (the settings I used in the code below reproduce the original settings): \documentclass{article} \usepackage[english]{babel} \usepackage[margin=2cm]{geometry}% just for the example \usepackage{xcolor} \usepackage{amsthm} \usepackage{thmtools} ...


2

If I fix the unrelated errors in your example (missing files and unescaped _ in headings) then as expected there are no page breaks between the headings: \documentclass[a4paper,11pt,titlepage]{article} \title{...} \author{...} %%Packages \usepackage[utf8]{inputenc} \usepackage{hyperref} \usepackage{float} \usepackage{caption} %%Commands ...


1

If you use \begin{table}[p] then the tables are restricted to float pages and no text will be under them. Note however that by default latex will not put text under a float unless at least 20% of the page has text. This is the parameter \textfraction which by default (and in article class) is set at 0.2.



Top 50 recent answers are included