“Hack” Long Table using Tabularx LaTex

When creating a table in LaTex I really like using tabularx package, it is easier to control the width of the column (and I think it is the most important part of creating table). But one of the drawbacks, tabularx didn’t support long table. It means you can’t create a table through the page using it.

But I found a simple “hack” to create a long table. I said it is a “hack” because we will not create a really long table, but we create two tables with the same properties and make it look like a long table. This is how we do it:

  • Create two table with same properties, make sure the second table is on the second page. You can use \newpage  command or just put your second table in the first table.
\begin{table}[H]
\caption{Table 1}
\begin{tabularx}{6.25in}{}
...
\end{tabularx}
\end{table}

\begin{table}[H]
\caption{Table 2}
\begin{tabularx}{6.25in}{}
...
\end{tabularx}
\end{table}
  • Next, make sure your second table number is same as the first one. You can do that by put \addcounter  before define the second table. It will subtract your current table numbering by 1.
...
\addtocounter{table}{-1}
\begin{table}[H]
\caption{Table 2}
...<span id="mce_marker" data-mce-type="bookmark" data-mce-fragment="1">​</span>
  • The last, remove the second table from indexing in Table of Content, by put a square bracket in the caption
...
\caption[]{Table 2}
...

and done! we just create a “hack” version of a long table!

OF course the bad of this long table is we can’t automatically move the last item in the first table and put it in the second table when need it. But at least, it looks like a long table 😉 and we didn’t need to automate everything right? If you have any suggestions to create a long table using tabularx, put a comment below!

Thank You!

image from: https://www.potterybarn.com/

Create custom Ubuntu terminal commands

A few days ago I invited in the Grand Final of Kode Indonesia in Jakarta. That is a programming contest held by Kalibrr. Different with other programming competitions that I have ever participated in, I realized in this competition the organizer doesn’t provide computer or notebook for participants so I must use my own notebook in the grand final.

So, my first thought for preparing my notebook for competition is

let’s create a simple command to compile C++ file!

The default command that I used to compile C++ file in Ubuntu is:

g++ myfile.cpp -o outfile$

and then run the program using command:

./outfile

My mission is to simplify two commands above become one simple command. This is the way how I do it:

  1. Create a script file, let say customcpp.sh
  2. Add in the very first line#!/bin/bash , then your command after it. So in my case it will content
    #!/bin/bash
    CPPFILE="$1"
    g++ ${CPPFILE}.cpp -o outfile
    ./outfile
  3. Move your file to /usr/local/bin you can move it by using terminal using command below. SCRIPTNAME is the command which you will use to call this script in the terminal. I use cmps as SCRIPTNAME
    sudo mv ~/customcpp.sh /usr/local/bin/SCRIPTNAME
  4. Set the correct permission and done!
    sudo chown root: /usr/local/bin/cmps
    sudo chmod 755 /usr/local/bin/cmps

After set the custom command, now I just need to run in the terminal cmps mycppfile  to compile and run the cpp file. It faster though than before 😉

Refference:

https://askubuntu.com/questions/789476/how-to-create-my-own-terminal-commands

Recognizing Arabic Letter Utterance using Convolutional Neural Network

Arabic letters have unique characteristics because of similarity of sound produced when reciting few letters. This paper present one of application Convolutional Neural Network (CNN) in speech recognition Arabic letters. CNN has shown very good performance for image and speech recognition int the last few years. This study examined the several types of CNN models as well as compare with some Deep Neural Network (DNN) models to speech datasets used. As a result, CNN with a convolution layer and one layer fully-connected managed to obtain an accuracy of up to 83.00%, far better than the traditional DNN that only able to reach 79.25%.

Download here: http://ieeexplore.ieee.org/document/8022720/

This is my first published paper,  not really good, or advance 🙁
but I hope it useful! 🙂

Belajar dari Stackoverflow

Salah satu yang berat menurut saya untuk belajar Artificial Intelligence/Machine Learning/Data Mining adalah untuk belajar saja, kadang kita perlu menuliskan sintaks kode yang lumayan panjang dan kompleks. Kadang hal ini yang bikin jadi down dulu sebelum memulai belajar.

Nah, salah satu solusi belajar yang saya temui cukup membantu saya adalah dengan aktif di Stackoverflow. Ya, bagi kita para programmer situs itu bukanlah situs yang asing. Kadang ketika kita menemukan eror atau kesulitan, lalu mulai googling untuk mencari solusi, maka Stackoverflow lah yang sering memberi jawaban.

Ketika saya menyarankan untuk ‘aktif’, di sini maksudnya bukan sekadar mencari jawaban orang lain tapi aktiflah untuk mencari pertanyaan dan memberi jawaban.

1. Mencari Pertanyaan

Ya, cobalah mencari pertanyaan yang setopik dengan materi yang ingin kalian perlajari. Telusuri satu persatu pertanyaan yang sudah pernah ditanyakan, siapa tahu kalian menemukan pertanyaan atau jawaban yang menarik yang sebenarnya cukup penting untuk ditanyakan tapi kita tidak pernah terpikirkan.

Dengan melihat jawaban orang lain kita juga jadi bisa menambah wawasan dengan menemukan solusi solusi menarik bagaimana orang menyelesaikan masalahnya.

2. Memberi Jawaban

Dengan mencoba menjawab beberapa pertanyaan, kita akan belajar untuk memahami lebih dalam materi yang kita pelajari. Kalau ada orang bilang, dengan mengajar ilmu kita bertambah, maka benar saja, dengan mencoba menjawab pertanyaan-pertanyaan di sana kita akan semakin bertambah wawasannya. Kita akan belajar bagaimana menjelaskan dan memberi contoh yang menjawab pertanyaan pengguna lain.

MVCE

Tips lain ketika ingin aktif di Stackoverflow adalah dengan membaca terlebih dahulu aturan di sana, seperti bagaimana cara bertanya dan menjawab yang baik. Di sini kalian akan mengenal istilah MVCE (Minimum Veriviable Complete Example), atau bagaimana memberikan contoh program kita yang eror secara minimalis. Kita akan belajar bagaimana menjelaskan eror pada program kita secara baik kepada orang lain.

Belajar AI

Dan salah satu manfaat yang saya dapat adalah dengan mencoba melihat dan menjawab pertanyaan-pertanyaan di Stackoverflow seputar AI/ML/DM kita akan mendapat wawasan sekaligus berlatih dengan jumlah baris kode yang ditulis tidak terlalu banyak 😉 Semoga Bermanfaat!

Latex : Insert Arabic Text in MIPA SKRIPSI TEMPLATE

Few days I was learning Latex for my Thesis. I use MIPA UGM SKRIPSI TEMPLATE for my work. It was created by Drs. Pekik Nurwantoro, Ph.D. then modified by my friend Yusuf Syaifudin. I was using pdflatex as command to compile latex file in my ubuntu machine, until I got stuck to insert arabic text in my document.

The real problem is because I use Template from MIPA UGM it is difficult to insert arabic font without broke anything. I was tried using babel or polyglossia but it always ended up compile error 🙁

I decided to using xelatex compiler because some people said it is difficult put arabic letter using pdf latex which doesn’t support unicode. Then after try many solutions I’ve found the best one:

1. Install XeTeX. sudo apt-get install texlive-xetex
2. Download arabic font. e.g. Scheherazade
3. Add this arabic font in your document:

 usepackage{fontspec}
 \newfontfamily\arabicfont[Script=Arabic]{Scheherazade}

4. use \arabicfont before your arabic text:

This is english document {\arabicfont وَهَذِهِ فِقرَةٌ بِالعَرَبِيَة مَعَ كَلِمَة اِنكلِيزِيَة } and this is the other english text.

When you compile using command xelatex yourdoc.tex, may be you will say “It works!” but actually don’t. When you see the result carefully it’s not RTL (right to left). So how to make it RTL?

5. Download bidi.tex from texdoc.net/texmf-dist/tex/xelatex/bidi/bidi.tex don’t use \usepackage{bidi} I don’t know it will make your document error. bidi.tex is a minimize version of bidi.

6. And input it after you define arabic font:

\usepackage{fontspec}
\newfontfamily\arabicfont[Script=Arabic]{Scheherazade}
\input{bidi.tex}

7. And now it really works! try to use \RL and \arabic font:

This is english document \RL{\arabicfont وَهَذِهِ فِقرَةٌ بِالعَرَبِيَة مَعَ كَلِمَة اِنكلِيزِيَة } and this is the other english text.
the result

Now you can use arabic font in MIPA SKRIPSI TEMPLATE 🙂 you can put the codes at point 6 in ADDITIONAL_PACKAGE.tex if you are using MIPA UGM SKRIPSI TEMPLATE. Hope it help! let me know if you have another solution 🙂

Refferences:

  • https://tex.stackexchange.com/questions/141867/minimal-bidi-for-typesetting-rl-text