Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with samepage=true #15

Closed
eendebakpt opened this issue Dec 6, 2013 · 4 comments
Closed

problem with samepage=true #15

eendebakpt opened this issue Dec 6, 2013 · 4 comments
Labels

Comments

@eendebakpt
Copy link

I am trying to prevent an environment from splitting over 2 pages. The option samepage=true prevents the block from splitting, but the label (part of the frame) is still placed on a separate page.

Example code showing the problem is included below.


\documentclass[a4paper,notitlepage]{article}
\usepackage{minted}

\newminted{cpp}{mathescape, numbersep=5pt, frame=lines, samepage=true, fontsize=\small,label=C++ interface}

\title{Test}
\author{Pieter}

\begin{document}

\section{Test document}

This is a test
xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx
xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx
xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx
xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx

xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx
xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx
xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx

yyy yyy yyyyy yyyy y yyyy yyy yyy yy yyyyy yyyyyyyyy yyyy yyyyy
yyy yyy yyyyy yyyy y yyyy yyy yyy yy yyyyy yyyyyyyyy yyyy yyyyy
yyy yyy yyyyy yyyy y yyyy yyy yyy yy yyyyy yyyyyyyyy yyyy yyyyy

xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx
xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx
xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx

xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx
xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx
xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx

xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx
xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx
xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx

xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx
xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx
xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx

\begin{cppcode}
struct xxx
{
int i;
int j;
int x;
int y;
int z;

/// Constructor functions
xxx();
xxx(int index);
~xxx();
xxx(const xxx &);

public:
void test1();

void test2();

void test3();

void test1b();

void test2b();

void test3b();

...

}
\end{cppcode}

xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx

\subsection{End of test}

xx xxxxx xx xx xx xxxxx xx xxxxx xxxx xxxxx xxxx x xxxxxx xxxx

\end{document}

@gpoore
Copy link
Owner

gpoore commented Dec 12, 2013

Internally, minted uses the fancyvrb package to handle many things. The samepage option is actually passed to fancyvrb, and I've replicated the issue using fancyvrb alone, without minted. So fixing this would require a patch for fancyvrb. After a quick look at the fancyvrb source, I suspect that fixing this would require a good deal of work, since it appears that the current samepage is only designed to work with to the block of verbatim text itself, rather than the title. Unfortunately, I don't have the background to patch this part of fancyvrb.

Here are some related links. You might try asking a question about fancyvrb and titles on TeX.SE.

@gpoore
Copy link
Owner

gpoore commented Jan 15, 2014

I'm closing this, since it's due to fancyvrb rather than minted. If a new version of fancyvrb is ever created, this should be added to the list of requested upgrades.

@gpoore gpoore closed this as completed Jan 15, 2014
@lucbouge
Copy link

Dear colleagues,

Did this issue make any progress since 2014? I encountered the same issue a few days ago. I use

\setminted{
fontfamily=sf,
autogobble=true,
frame=lines,
framesep=2mm,
bgcolor=very-light-gray,
samepage=true
}

and the bottom frame separator was rejected on the next page.

Regards,

Luc.

@gpoore
Copy link
Owner

gpoore commented Jan 21, 2019

@lucbouge Unfortunately, I am not aware of any progress. fancyvrb is still essentially the same, and I'm not aware of any patches for it that would fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants