I am trying do to a custom template for minted with background color, line number, title,... However I have an issue with the end of the page. The code are not splitting to a new page but just continue and "go out" of the page.

enter image description here





    showtabs =false,

breakable,% Allow page breaks
listing engine=minted,
listing only,#1, title=#3, minted language=#2,
sharp corners, top=0mm, bottom=0mm,
title code={\path[draw=mintedframe,dashed, fill=mintedbackground](title.south west)--(title.south east);},
frame code={\path[draw=mintedframe, fill=mintedbackground](frame.south west) rectangle (frame.north east);}




On appelle Lvalue (left value) tout objet pouvant être placé à gauche d'un opérateur d'affectation. Une Lvalue est caractérisée par :
    \item son adresse, c'est-à-dire l'adresse-mémoire à partir de laquelle l'objet est stocké ;
    \item sa valeur, c'est-à-dire ce qui est stocké à cette adresse.

Un pointeur est un objet (Lvalue) dont la valeur est égale à l'adresse d'un autre objet. 

La valeur d'un pointeur étant un entier, on peut lui appliquer un certain nombre d'opérateurs arithmétiques classiques. Les seules opérations arithmétiques valides sur les pointeurs sont :
    \item l'addition d'un entier à un pointeur. Le résultat est un pointeur de même type que le pointeur de départ ;
    \item la soustraction d'un entier à un pointeur. Le résultat est un pointeur de même type que le pointeur de départ ;
    \item la différence de deux pointeurs pointant tous deux vers des objets de même type. Le résultat est un entier. 
Include stdio.h

enum kernel_states {

struct kernel_context {
    uint32_t regs[15];
    uint32_t psr;

struct kernel_tcb {
    struct kernel_context context;
    enum kernel_steates state;
    struct kernel_tcb* t_next;
    struct kernel_tcb* s_next;
    int32_t id;
    char name[32];
    uint32_t stack_size;
    uint32_t stack[] //défini au runtime avec un malloc

Extern …

\#R0 : context of former thread

\#R1 : context of new thread
.global kernel_transfer

    stmia   r0, {r0-r12,sp,lr}
    mrs     r4,cpsr
    str     r4,[r0,#15*4]
    ldr     r4,[r1,#15*4]
    msr     cpsr, r4
    ldmia   r1,{r0-r12,sp,pc]

extern void kernel_transfer(
    struct kernel_context* former;
    struct kernel_context* new;s

static struct kernel_tcb idle_tab = {
    .state = KERNEL_RUNNING;
    .t_next = &idle_task;
    .id = 0;
    .name = "idle";
    .stack_size = 0;

static struct kernel_tcb* running_task = &idle_task;
static int32_t task_id = 1;

// Place next task to the list
void kernel_add_tcb(struct kernel_tcb){
    tcb->t_next = idle_task.t_next;
    idle_task.t.next = tcb;

struct kernel_tab" kernel_new_tcb(uint32_t stack_size, const char* name){
    struct kernel_tcb* tcb = malloc (sizeof(struct kernel_tab) + stack_size);
    tcb->id = kernel_new_taskid();
    // If cannot allocate space
    if(tcb==0) return 0;
    memset(tcb, 0, sizeof(struct kernel_tab));
    tcb->stack_size = stack.size;
    // Only copy the 32 first char (ignore the next ones)
    strncpy(tab->name, name, sizeof(tcb->name);
    return tcb;

int32_t kernel_new_taskid(){
    static int32_t task_id = 0;
    return task_id++;

struct kernel_tab kernel_running_task(){
    return running_task;
void kernel_yield(){
    struct kernel_tcb* former_task = running_task;
    struct kernel_tcb* new_task = former_task->t_next;
    if(former_task->state == KERNEL_RUNNING) former_task->state = KERNEL_READY;
    while(new_task->state) != KERNEL_READY) new_task = new_task->t_next;
    running_task = new_task;
    new_task->state = KERNEL_RUNNING;
    kernel_transfer(&former_task->context, &new_task->context);
  • 3
    Welcome! Did you try adding breakable to the options? – egreg Apr 3 at 19:50
  • I just tried it, but it doesn't change – flo17 Apr 3 at 20:21
  • Please, complete the code snippet to a full document; don't bother to add the listing to be typeset, it's easy to get a long one. – egreg Apr 3 at 21:00
  • 1
    Please, not on Overleaf, but here, purging it from the useless parts. If I add breakable, I get page breaks in my example with the article class. There must be something else going on. You should first of all get rid of the errors you get. – egreg Apr 3 at 21:12
  • 2
    Oh, I see: as usual, Overleaf is lagging behind and the version of tcolorbox it has doesn't support breakable. There is a reason why I recommend avoiding Overleaf. – egreg Apr 3 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.