Text FormattingIssue with text formating in landscape section

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
giby
Posts: 11
Joined: Mon Oct 04, 2010 5:46 pm

Issue with text formating in landscape section

Post by giby »

Hello all,

I try to color few letters in a line in a landscape section, unfortunatly the colored text is not where it should be.

Try that about minimal code to understand:
\documentclass[10pt,letterpaper]{article}

\def\zz{\par\zzz}
\def\zzz#1{%
\ifx!#1\hfill\else
\makebox[.75em]{\ifx.#1\else\ifx|#1$|$\else#1\fi\fi}%
\expandafter\zzz
\fi}

\usepackage{lscape}
\usepackage{xcolor}
\begin{document}
Hello World

\begin{landscape}
\zz GTGTTTGACCGCCTTTGGTTCTTGGCCGAGGT{\color{red}TGGTATCAGCATCCAAGT} ! Leymus arenarius
\zz GTGTTTGATCGTCTTTGGTTCTTGGGCCGAGGTGGTATCAGTAAAGCATC ! Brachypodium distachyon
\zz GTGTTTGATCGTCTTTGGTTCTTGGGCCGAGGTGGTATTAGTAAAGCATC ! Aegilops tauschii

\end{landscape}

Good bye world

\end{document}



Thanks in advance for your help

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Issue with text formating in landscape section

Post by Ijon Tichy »

Not landscape is the problem. The problem is, that {\color{red}TGGTATCAGCATCCAAGT} for your \zzz ist a single argument and so the \makebox is to small. To avoid this, you could, e.g., split the first line:
\documentclass{article}% 10pt, letterpaper are default and therefore removed

\def\zz{\let\zzzend\hfill\par\zzz}
\def\noparzz{\let\zzzend\hfill\zzz}
\def\nofillzz{\let\zzzend\relax\par\zzz}
\def\zzz#1{%
\ifx!#1\zzzend\let\zzzend\relax\else
\makebox[.75em]{\ifx.#1\else\ifx|#1$|$\else#1\fi\fi}%
\expandafter\zzz
\fi}

\usepackage{lscape}
\usepackage{xcolor}
\begin{document}
Hello World

\begin{landscape}
\nofillzz GTGTTTGACCGCCTTTGGTTCTTGGCCGAGGT!{\color{red}\noparzz TGGTATCAGCATCCAAGT!}
Leymus arenarius
\zz GTGTTTGATCGTCTTTGGTTCTTGGGCCGAGGTGGTATCAGTAAAGCATC ! Brachypodium distachyon
\zz GTGTTTGATCGTCTTTGGTTCTTGGGCCGAGGTGGTATTAGTAAAGCATC ! Aegilops tauschii

\end{landscape}

Good bye world

\end{document}
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
giby
Posts: 11
Joined: Mon Oct 04, 2010 5:46 pm

Issue with text formating in landscape section

Post by giby »

Thanks a lot ;)
Post Reply