Monthly Archives: May 2018

LaTex Cheat-Sheet

Symbole und Zeichen

LaTeX/Page Layout
LaTeX-Kompendium: Für Mathematiker
LaTeX-Kompendium: Sonderzeichen
Liste mathematischer Symbole

Abstände / Leerzeichen

Abstände in LaTex (PDF)
Leerzeichen

Silbentrennung

LaTeX-Wörterbuch: Silbentrennung

Mehrspaltige Umgebung

LaTeX-Wörterbuch: multicols
Multiple columns

\usepackage{multicol}

\begin{document}	
    \begin{multicols*}{2}
        \lipsum[1-8]
    \end{multicols*}
\end{document}

Unterschiedliche Spaltenbreiten

Different column widths using multicol

\usepackage{vwcol}

\begin{document}	
    \begin{vwcol}[widths={0.6,0.4},
                  sep=.8cm,
                  justify=flush
                  rule=0pt
                  indent=1em]
        \lipsum[1-8]
    \end{vwcol}
\end{document}

Anderes Papierformat

\usepackage[
    left=3mm,
    right=6mm,
    top=5mm,
    bottom=5mm,
    papersize={8cm,28.5cm}
]{geometry}

Einfügen externer LaTex Dateien ins aktuelle Dokument

When should I use \input vs. \include?

\input
\include

Schriftart (Font) setzen

LaTeX font size

Zeilenabstand innerhalb eines Ansatzes

baselineskip, Legt den Zeilenabstand innerhalb eines Absatzes fest.

\baselineskip <Abstand>
\setlength{\baselineskip}{<Abstand>}

Textbreite

Textbreite

\textwidth
\columnwidth
\linewidth          (number of characters per line) 

\showwidth{textwidth}
\showwidth{columnwidth}
\showwidth{linewidth}

Zellen einer Tabelle (array,tabular) zusammenführen (merge)


How to merge columns in a table?

Tabellen Abstände zwischen Zeile/Spalte

How do I change column or row separation in LaTeX tables?
Horizontal Line Separating Steps in Aligned Equation

\setlength{\tabcolsep}{20pt}
\renewcommand{\arraystretch}{1.5}

\arraycolsep=1.5pt\def\arraystretch{1.2}

mdframed – Horizontale Linien

How to create Multilevel Colored Boxes using tcolorbox/any other package?

\cline{1-2}
\hline
\midrule
\rule{length}{thickness}
\noindent\rule{\textwidth}{1pt}
% \draw[option] (x,y) (w,h)
\newcommand{\sepline}[2]{
	\vspace{#1}
	\par\noindent\makebox[\linewidth][l]{%
		\hspace*{-\mdflength{innerleftmargin}}%
		\tikz\draw[thick,dashed,gray!60] (0,0) --%
		(\textwidth+\the\mdflength{innerleftmargin}+\the\mdflength{innerrightmargin},0);
	}\par\nobreak
	\vspace{#2}
}

\begin{document}
	\begin{mdmath}
		\begin{flalign*}
			y' &= C \cdot f'(x)
		\end{flalign*}
		\sepline{-1.3cm}{-1.2cm}
		\begin{flalign*}
			y' &= f_1'(x) + f_2'(x)
		\end{flalign*}
	\end{mdmath}
\end{document}

SVG Einbinden in LaTex

SVG -> PDF mit Inkscape

"C:\Program Files\Inkscape\inkscape.exe"
-z -D
--file=2017_aufgabe3_img.svg
--export-pdf=2017_aufgabe3_img.pdf
--export-latex

Abstand zwischen Formel und Text

Abstand vor und nach den Gleichungen
Wie stelle ich die Abstände vor und nach abgesetzten Gleichungen bzw. Formeln ein?

\abovedisplayskip      % 10pt plus 2pt minus 5pt
\abovedisplayshortskip % 0pt plus 3pt
\belowdisplayskip      % 10pt plus 2pt minus 5pt
\belowdisplayshortskip % 6pt plus 3pt minus 3pt

\setlength\abovedisplayshortskip{0pt}
\setlength\belowdisplayshortskip{0pt}
\setlength\abovedisplayskip{20pt}
\setlength\belowdisplayskip{20pt}
\apptocmd\normalsize{% 
	\setlength\abovedisplayshortskip{0cm}% 
	\setlength\belowdisplayshortskip{0cm}% 
	\setlength\abovedisplayskip{0.2cm}% 
	\setlength\belowdisplayskip{0.25cm}% 
}{}{\undefined} 

Bezeichnungen beim Paket german
Original Übersetzung ggf. Alternativen
\preface Vorwort
\ref Literatur
\abstract Zusammenfassung
\bib Literaturverzeichnis
\chapter Kapitel
\appendix Anhang
\contents Inhaltsverzeichnis Inhalt
\listfigure Abbildungsverzeichnis Abbildungen
\listtable Tabellenverzeichnis Tabellen
\index Index oder Sachregister
\figure Abbildung
\table Tabelle Tafel
\part Teil
\encl Anlage(n) Beilage(n)
\cc Verteiler Kopien an
\headto An
\page Seite
\see siehe
\also siehe auch
\proof Beweis (babel)
\glossary Glossar (babel)

Qt

Tutorials

Crash course in Qt for C++ developers, Part 1
Qt für C++-Anfänger

Installation

Qt

Build

$ qmake project.pro

Switch between Qt4 and Qt5

How do I change which version of Qt is used for qmake?

$ qtchooser -list-versions
4
5
default
qt4-x86_64-linux-gnu
qt4
qt5-x86_64-linux-gnu
qt5

c$ QT_SELECT=qt4 qmake --version
qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory

$ QT_SELECT=qt5 qmake --version
QMake version 3.1
Using Qt version 5.9.1 in /usr/lib/x86_64-linux-gnu

Serial

Project ERROR: Unknown module(s) in QT: serialport

$ QT_SELECT=qt5 qmake candle.pro 
Info: creating stash file /home/andreas/src/Candle/src/.qmake.stash
Project ERROR: Unknown module(s) in QT: serialport

$ sudo apt-get install libqt5serialport5-dev

How to use CMake / CMake HowTo

stackoverflow

Debug vs Release in CMAKE
How can I add a flag at the end of the linking command line using CMake?
Cmake target_link_libraries not linking my library
cflags ‘-Wl,-export-dynamic’ vs linker flags ‘-export-dynamic’

Microsoft

Create a CMake Linux project in Visual Studio
Download, install, and set up the Linux workload
Create a Linux MSBuild C++ project in Visual Studio

Blog

Henry Schreiner

CMake: Best Practices (PDF)
ISciNumPy (Blog), A random collection of Science, Numerics, C++, CMake, and Python related topics.
An Introduction to Modern CMake (eBook)
HSF – More Modern CMake (Workshop)
gitlab.com/CLIUtils/modern-cmake-interactive-talk (Talk), A talk first given for PICSciE
LinkedIn: Henry Schreiner

dmerej’s blog

Let’s Build Chuck Norris! – Part 1: CMake and Ninja
Let’s Build Chuck Norris! – Part 2: SQLite and conan
Let’s Build Chuck Norris! – Part 3: A C wrapper
Let’s Build Chuck Norris! – Part 4: Python and ctypes
Let’s Build Chuck Norris! – Part 5: Python and cffi
LinkedIn: Dimitri Merejkowsky

The Ultimate Guide to Modern CMake
LinkedIn: Rico Huijbers

SCHNEIDE BLOG – Softwareschneiderei GmbH

Modern CMake with target_link_libraries

Flameeyes’s Weblog

Why would an executable export symbols?

Meson Build

  • Meson
  • CMake
  • SCons
  • Premake
  • Autotools

A simple comparison

GitHub

github.com/GENIVI/vsomeip/blob/master/CMakeLists.txt

ARM Stack Frame / Backtrace

ARM: link register and frame pointer
ARM Stack Frame Layout
ARM GCC generated functions prolog
ARM Procedure Call Standard (APCS)
Procedure Call Standard for the ARM Architecture (AAPCS)
On the AAPCS, with an application to efficient parameter passing
ARM to C calling convention, registers to save

General

Der Stack Frame
Deep Wizardry: Stack Unwinding
What is exactly the base pointer and stack pointer? To what do they point?
What is stack unwinding?
Stack Unwinding in C++
github.com/evgeny-panasyuk/stack_unwinding, The stack_unwinding is a small header only C++ library which supplies primitive(class unwinding_indicator) to determining when object destructor is called due to stack-unwinding or due to normal scope leaving.

backtrace

libc Backtraces
How to automatically generate a stacktrace when my gcc C++ program crashes
Backtrace on ARM has repeating entries

libunwind / Call chain

  • allows you to easily walk the stack frames
  • access to the callee-saved registers contents
  • support for resuming execution at a certain frame

The libunwind project
KenWerner/Sandbox/libunwind – Linaro Wiki
Stack frame unwinding on ARM (2011)

#define UNW_LOCAL_ONLY
#include <libunwind.h>

void show_backtrace (void) {
  unw_cursor_t cursor; unw_context_t uc;
  unw_word_t ip, sp;

  unw_getcontext(&uc);
  unw_init_local(&cursor, &uc);
  while (unw_step(&cursor) > 0) {
    unw_get_reg(&cursor, UNW_REG_IP, &ip);
    unw_get_reg(&cursor, UNW_REG_SP, &sp);
    printf ("ip = %lx, sp = %lx\n", (long) ip, (long) sp);
  }
}

libbacktrace

github.com/ianlancetaylor/libbacktrace, A C library that may be linked into a C/C++ program to produce symbolic backtraces (2018)

Android

Before Android 8.0, crashes were handled by the debuggerd and debuggerd64 daemons. In Android O and later, crash_dump32 and crash_dump64 are spawned as needed.
Debugging Native Android Platform Code
android / platform / system / core / libbacktrace
android / platform / system / core / include / backtrace / backtrace.h/a>
android / platform / system / libbacktrace / Backtrace.cpp
android-aosp-sdcard debuggerd backtrace.c, Rewrite libbacktrace using C++
am 98f87d92: Merge “Rewrite libbacktrace using C++.”

backtrace_create_context()
dump_backtrace_to_log()
Breakpoint 1, main () at /home/andreas/src/DermoInspectMiniServer/src/tcp_server.cpp:79
79          A();
(gdb) info register pc lr sp fp
pc             0x142824 0x142824 <main()+72>
lr             0x76d7b208       1993847304
sp             0x7efff568       0x7efff568
fp             0x7efff5fc       0x7efff5fc

(gdb) s
A () at /home/andreas/src/DermoInspectMiniServer/src/tcp_server.cpp:72
72              B();
(gdb) info register pc lr sp fp
pc             0x1427d0 0x1427d0 <A()+8>
lr             0x142828 1321000
sp             0x7efff560       0x7efff560
fp             0x7efff564       0x7efff564

(gdb) s
B () at /home/andreas/src/DermoInspectMiniServer/src/tcp_server.cpp:67
67              C();
(gdb) info register pc lr sp fp
pc             0x1427bc 0x1427bc <B()+8>
lr             0x1427d4 1320916
sp             0x7efff558       0x7efff558
fp             0x7efff55c       0x7efff55c

(gdb) s
C () at /home/andreas/src/DermoInspectMiniServer/src/tcp_server.cpp:62
62          MyBacktrace();
(gdb) info register pc lr sp fp
pc             0x1427a8 0x1427a8 <C()+8>
lr             0x1427c0 1320896
sp             0x7efff550       0x7efff550
fp             0x7efff554       0x7efff554

(gdb) s
100         frame = (struct frame*) ctx.uc_mcontext.arm_lr;
(gdb)
102         for (int i = 0; frame && frame->fr_savfp; i++) {
(gdb) info register pc lr sp fp
pc             0x170a74 0x170a74 <MyBacktrace()+32>
lr             0x170a6c 1509996
sp             0x7efff238       0x7efff238
fp             0x7efff54c       0x7efff54c

x86

Getting the call stack without a frame pointer