Skip to main content
Working from scratch, following simplicity

Come unire insieme pagine pari e dispari in un PDF con LaTeX

Presento un template LaTeX che permette di unire insieme due PDF contenenti rispettivamente la pagine dispari e quelle pari invertite o meno. Come sempre c'è una piccola area da modificare che non necessita alcuna conoscenza di LaTeX e se si è registrati in Overleaf si può fare tutta l'operazione online dal proprio browser.

Recentemente ho comprato una piccola stampante multifunzione che però non supporta lo scanner a doppia faccia e così devo caricare una facciata per volta. Alla fine ottengo due file PDF che poi dovrò unire manualmente.

In genere il primo contiene le pagine dispari ed il secondo quelle pari invertite (o pari in ordine crescente come le dispari se le riordino prima di darle in pasto al caricatore dello scanner, ma è una cosa che detesto fare). Per unirli potrei usare uno dei tanti programmi che si trovano su internet (ne parlo anche nell'articolo Software liberi per modificare i PDF) ma come ben sapete mi piace complicarmi la vita e quindi ho risolto il mio problema con LaTeX!

How to merge odd and even pages together in a PDF with LaTeX

Requisiti

  • Funziona coì come è in Overleaf[fn]Overleaf è il nuovo sistema di scrittura e pubblicazione sviluppato dalla stessa società dell'editor writeLaTeX. È pensato per rendere tutto il processo di scrittura, modifica e produzione di articoli scientifici più veloce, sia per gli autori che per gli editori. Overleaf è uno strumento collaborativo di scrittura e pubblicazione con integrato una anteprima in PDF. Qui c'è il mio collegamento per registrarsi a Overleaf.[/fn], ma è richiesta la registrazione per poter aggiungere i propri file PDF e modificare il mio modello.
  • Nel proprio computer oltre a LaTeX c'è bisogno di un editor e dei seguenti pacchetti: mathptmx, moresize, comment, ifthen e pdfpages (presenti quasi tutti in una tipica installazione LaTeX)..

Come funziona

L'intero processo si può riassumere nelle infografiche di seguito e modificando il file di testo più sotto per generare il PDF di unione.

  • How to merge odd and reversed even pages together in a PDF with LaTeX
    reversed{1}
  • How to merge odd and even pages together in a PDF with LaTeX
    reversed{0}
% <---------------------- EDIT THIS AREA ONLY ----------------------------->

%%
%% Define the file names and the dimension of your PDF
%% Put the size in mm
%% The typical size of an A4 document is 210x297 mm
%%
\newcommand\units{mm}			% <--- set the units (default mm)
\newcommand\fileOdd{odd.pdf}		% <--- the PDF that contains odd pages
\newcommand\fileEven{even_rev.pdf}	% <--- the PDF that contains even pages
\newcommand\width{210} 			% <--- the width size in mm of your PDF
\newcommand\height{297} 		% <--- the height size in mm of your PDF
%%
%% 			Are reversed the even pages?
\newcommand\reversed{1} 	% <--- "1" YES, "0" NO
%%
%% 			How many pages do you want to process?
\newcommand\numberPages{3} 	% <--- the numbers of pages to process
%%
% <---------------------- EDIT THIS AREA ONLY  ----------------------------->

Editando l'area di testo si controlla tutto il processo e si genera così il PDF finale.

Download

Lo si può trovare e scaricare da Overleaf e da GitHub qui:

Add new comment

The content of this field is kept private and will not be shown publicly.

Plain text

  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

Add new comment

The content of this field is kept private and will not be shown publicly.

Plain text

  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Sponsored Links
Pubblicità

Nicola Rainiero

A civil geotechnical engineer with the ambition to facilitate own work with free software for a knowledge and collective sharing. Also, I deal with green energy and in particular shallow geothermal energy. I have always been involved in web design and 3D modelling.