quinta-feira, 14 de setembro de 2017

Certificados em Latex

Olha que maneiro! Precisamos de 2 arquivos: Um que é o Certificado e outro que é a lista de nomes.

Certificado.tex --------------------------------------------------

\documentclass[a4page]{article}
\usepackage[utf8]{inputenc} 
\usepackage{eurosym}
\usepackage{textmerg} 
\usepackage[left=2cm,right=1cm,bottom=1cm,top=1cm]{geometry}
\usepackage{lscape}
\usepackage{graphicx}
\usepackage{times}
\usepackage{overpic}


\begin{document}
\begin{landscape}
\begin{center}

\Fields{\Name}
\Merge{data.dat}{
\fbox{
\begin{minipage}{1.3\textwidth}
\centering
\vspace{1cm}
\centerline{\includegraphics[scale=.4]{logo}}
\vspace{1cm}
\par
\huge{\textbf{\textsc{Certificate of participation}}}
\\
\vspace{2cm}
{
  \LARGE{\itshape This is to certify that \textbf{\Name }~ has participated\\
    in the 16th Brazilian Symposium on Computer Music\\
    held at the University of São Paulo, Brazil, on September 3-6 2017.\par}

}
\vspace{2cm}
\hbox to 0.9\textwidth{\centering \hfill\includegraphics[scale=0.7]{Assinatura}}
\hbox to 0.9\textwidth{\centering \hfill\Large Marcelo Queiroz}
\hbox to 0.9\textwidth{\centering \hfill\Large\bfseries SBCM 2017 General Chair}
\vspace{0.4cm}
\end{minipage}
}%fbox
\newpage
}%Merge
\end{center}
\end{landscape}
\end{document}

data.dat -------------------------------------------------------------------------

Fulano da Silva

Beltrano de Souza

Cicrano Schiavoni

Teste de Certificado  dos Campos Latex

...


Resultado? Um PDF com várias páginas, uma por nome.



quarta-feira, 19 de julho de 2017

OCR em arquivos PDF

Passo 1: Primeiramente, separei o PDF em vários arquivos, cada um com uma página, com o comando:
pdftk nome_do_arquivo.pdf burst

Fiz isto pois os próximos passos são boatwares e fizeram minha máquina reiniciar algumas vezes. :-)

Passo 2: Depois, converti cada uma destas páginas em uma imagem jpg com o comando:
for i in pg_0*pdf ; do convert -density 400 $i $i.jpg; done

Passo 3: Depois, usei o OCR (Optical Character Recognition) em cada uma das imagens, transformando-as em textos:
for i in pg_0*jpg ; do tesseract -l por $i $i; done

Passo 4: E isto resultou em um arquivo txt para cada página, conforme segue anexo.
Também fiz um arquivo txt com todas as páginas com o comando:
for i in pg_0*txt ; do cat $i >> completo.txt; done

E fiz um arquivo zip com os textos com o comando:
zip todos.zip pg*txt

Ou, em um único comando os passos 2, 3 e 4:

for i in pg_0*pdf ; do
echo "converting $i"
convert -alpha flatten -threshold 50% -background white -density 400 $i $i.png
tesseract -l por $i.png $i;
cat $i.png.txt >> completo.txt;
done

terça-feira, 25 de abril de 2017

Substituindo string em todos os arquivos

sed -i 's/foo/bar/g' *

Para substituir \n-\n

sed -i ':a;N;$!ba;s/\n-\n//g' *

Concatenando string no final de arquivos

echo "my text" | tee -a *.php

segunda-feira, 17 de abril de 2017

Convertendo imagens do libreoffice em PDF com crop

Salve no seu diretório ~/bin, dê permissões de execução e seja feliz!

for f in *odg
do
  if [ -f $f ] ; then
    echo "Checking ${f}"
    name=${f%\.*}
    if test ${name}.pdf -ot ${name}.odg ; then
       echo "Converting ${name}.pdf"
       libreoffice --headless --invisible --convert-to pdf ${name}.odg
       echo "Croping...."
       pdfcrop ${name}.pdf ${name}.pdf
    fi
  fi ;
done

Certamente é necessário instalar o libreoffice, o test (que costuma vir instalado) e o pdfcrop.

sábado, 18 de março de 2017

Convertendo vídeos de MKV para MP4

Convertendo vídeos de MKV para MP4.

avconv -i input.mkv -codec copy output.mp4

sexta-feira, 10 de fevereiro de 2017

Caderno de resumos - SBCM 2015

Caderno de resumos do SBCM 2015

\documentclass[10pt, a5paper, oneside]{book}
\usepackage{wasysym} % Music symbols, baby!
\usepackage{enumitem}
\setlist[itemize,1]{label={\eighthnote}}
\usepackage[utf8x]{inputenc}
\usepackage[brazil]{babel}
\usepackage{cite}
\usepackage{textcomp} %para o greater than
\usepackage{float}
\usepackage{placeins}
\usepackage{enumerate}
\usepackage{xspace}
\usepackage{colortbl}
\usepackage{hyperref}
\usepackage{pdfpages} %Para importar PDFs
\usepackage{afterpage} % Para pular página
\usepackage[absolute,overlay]{textpos} %posicao absoluta (usado na contracapa)
\usepackage{tocloft} % Pontinhos no Sumário
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}


% Fancy Chapter
%Options: Sonny, Lenny, Glenn, Conny, Rejne, Bjarne, Bjornstrup
\usepackage[Sonny]{fncychap}
\usepackage{titlesec}

\let\oldchapter\chapter
\renewcommand{\chapter}[1]{
\oldchapter*{#1}
\addcontentsline{toc}{section}{\protect #1}
}

% Para controlar margens e etc:
\textwidth 4.7in
\textheight 7.2in
\topmargin -0.8in
\oddsidemargin -0.40in
\evensidemargin -0.40in

\begin{document}
\pagenumbering{gobble}% Remove page numbers (and reset to 1)
% ------------------------------------------------------------------------------
% Capa

\include{Capa}

% ------------------------------------------------------------------------------
% Prologo
\include{prologue}

% Sumário
\tableofcontents

% ------------------------------------------------------------------------------
% Conteúdo
\pagenumbering{arabic}% Arabic page numbers (and reset to 1)

% Resumos
\part{Technical Papers and Posters}

\chapter{Copista - Sistema de OMR para a recuperação de acervo histórico musical}
Autor:
\begin{itemize}
   \item Avner Paulo (Universidade de São João del Rei)
   \item Flávio Schiavoni (Federal University of São João Del Rei)
   \item Marcos Laia (Universidade de São Paulo)
   \item Daniel Madeira (Universidade de São João del Rei)
\end{itemize}

The Optical Music Recognition (OMR) is a Computer Science field aplied to Music and has opening problems to recognize handwriten scores. This paper presents a project called ``Copista'' that is investigating techniques to develop a software to recognize handwriten scores.


% ------------------------------------------------------------------------------
%   CONTRA CAPA
\clearpage
\thispagestyle{empty}

\clearpage
% ------------------------------------------------------------------------------
\include{ContraCapa}
\end{document}

Anais do V Ubimus

Proceedings do V Ubimus - 2014

Template latex utilizado para gerar o proceedings do V Ubimus.



\documentclass[11pt, a4paper]{book}

\usepackage[utf8x]{inputenc}
\usepackage[brazil]{babel}

\usepackage{cite}
\usepackage{textcomp} %para o greater than
\usepackage{float}
\usepackage{placeins}

\usepackage{enumerate}
\usepackage{xspace}
\usepackage{colortbl}
\usepackage{hyperref}

\usepackage{pdfpages} %Para importar PDFs

\usepackage{afterpage} % Para pular página
\usepackage[dvipsnames]{xcolor}    % Para cor de fundo na página
\usepackage{color}
\usepackage{tikz} % para desenhar o retangulo lateral na capa
\usepackage{lipsum}  % Para testes
\usepackage[absolute,overlay]{textpos}

\usepackage{tocloft} % Pontinhos no Sumário


% Cabecalho com nome da secao
\usepackage{fancyhdr}

\fancyhf{}
\fancyhead[LE,RO]{\fancyplain{}{V Ubimus - 2014} }
\fancyhead[LO,RE]{\fancyplain{}{From Digital Arts to Ubiquitous Music} }
\fancyfoot[LE,RO]{\fancyplain{}{Vitória - ES - Brazil} }
\fancyfoot[LO,RE]{\fancyplain{}{\thepage} }
\renewcommand{\footrulewidth}{1pt}

%\fancyhf{}
%\fancyhead[LE,RO]{\thepage}
%\fancyhead[LO,RE]{\textit{\nouppercase{\leftmark}} }

\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\space#1}{}} 

% --- My Include command
\newcommand{\includepaper}[2]{
\includepdf[pages={1},scale=1,pagecommand={\addcontentsline{toc}{chapter}{#1}}]{#2}
\includepdf[pages={2-},scale=1,pagecommand={}]{#2}
}

\newcommand{\includepaperOP}[2]{ % One page paper
\includepdf[pages={1},scale=1,pagecommand={\addcontentsline{toc}{chapter}{#1}}]{#2}
}


% Para controlar margens e etc:
\textwidth 6.5in
\textheight 10.2in
\topmargin -0.8in
\oddsidemargin -0.20in
\evensidemargin -0.20in

\usepackage{titlesec}

%\titleformat{\chapter}[display]
%  {\normalfont\huge\bfseries}{}{0pt}{\Huge}
%\titlespacing*{\chapter}
%  {0pt}{10pt}{40pt}

\begin{document}
\pagenumbering{gobble}% Remove page numbers (and reset to 1)

% ------------------------------------------------------------------------------
%   CAPA
\clearpage
\thispagestyle{empty}
\definecolor{Roxo}{HTML}{593662}
\definecolor{Marrom}{HTML}{2c2c28}

\pagecolor{Roxo}

% Quadrado Esquerdo
\begin{textblock}{20}(-3,0)
\tikz \fill [Marrom] (0,0) rectangle (5,40);
\end{textblock}


\vspace*{\fill}

\begin{center}
\begin{minipage}{.6\textwidth}
{\color{white}
\vspace{3.7cm}

\begin{flushleft}
\large{\textbf{Anais do V Workshop de Música Ubíqua}}
\linebreak
\large{Proceedings of V Workshop on Ubiquitous Music}
\linebreak
\end{flushleft}
\centerline{\includegraphics[width=1\columnwidth]{logo-PT-small_1_2_0_0}}
\Huge{2014 - Vitória - ES - Brazil}
\vspace{2cm}
\begin{flushright}
\normalsize{
Das Artes Digitais à Música Ubíqua

From Digital Arts to Ubiquitous Music
}
\end{flushright}

\vspace{8cm}

\normalsize{
29 de Outubro a 1 de Novembro

October 29th - November 1st
}

}
\end{minipage}
\end{center}
\vfill % equivalent to \vspace{\fill}
\afterpage{\nopagecolor}
\clearpage

% ------------------------------------------------------------------------------
% Folha de rosto
\includepdf[pages={-},scale=1]{Rosto}

% ------------------------------------------------------------------------------
% Prologo
\include{prologue}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} % for chapters
\tableofcontents
\clearpage
% ------------------------------------------------------------------------------

\pagenumbering{arabic}% Arabic page numbers (and reset to 1)
\pagestyle{fancy}


\includepaper{Música ubiqua e paisagens sonoras. Possíveis contribuições}{1.pdf}
\includepaper{Exploring the potential of mobile technology for creating music collaboratively}{2.pdf}
\includepaperOP{DroneUnknown: An experiment in embracing unpredictability in live electronic performance}{3.pdf}
\includepaper{Suporte para a Criatividade Musical Cotidiana: Mixdroid Segunda Geração}{4.pdf}
\includepaper{Making meaningful musical experiences accessible using the iPad}{5.pdf}
\includepaperOP{Música Ubíqua no Colégio de Aplicação da UFRGS e Centro de Tecnologia Acadêmica e Ciência Cidadã Jr: transversalidades em pesquisa em ensino}{6.pdf}
\includepaper{The Beathealth Project: Synchronising Movement and Music}{7.pdf}
\includepaper{Characterizing Resources in Ubimus Research: Volatility and Rivalry}{8.pdf}
\includepaper{Prototyping of Ubiquitous Music Ecosystems}{10.pdf}
\includepaper{Ubiquitous Computing meets Ubiquitous Music}{11.pdf}
\includepaperOP{Progressive Disclosure}{12.pdf}
\includepaper{Computação Ubíqua e a interação corporal na aprendizagem de execução rítmica}{13.pdf}
\includepaperOP{Balance: um estudo sobre a tradução digital do corpo em equilíbrio}{14.pdf}


% ------------------------------------------------------------------------------
%   CONTRA CAPA
\clearpage
\thispagestyle{empty}
\pagecolor{Roxo}
\newpage
\vspace*{\fill}

% Quadrado Esquerdo
\begin{textblock}{20}(14,0)
\tikz \fill [Marrom] (0,0) rectangle (5,40);
\end{textblock}

{\color{white}
\centerline{\includegraphics[width=0.3\columnwidth]{logo-PT-small_1_2_0_0}}
\vspace{1cm}
2014 - Vitória - ES - Brazil
}

\clearpage
% ------------------------------------------------------------------------------

\end{document}