Hello all,
This question puzzles me a lot... I am trying to print something like that with indents on the left:
=INDEX(List,
.......SMALL(IF(MATCH(List,List,0)
..................=ROW(INDIRECT(”1:”&ROWS(List))),
................MATCH(List,List,0),
................””),
.......ROW(INDIRECT(”1:”&SUM(SIGN(MATCH(List,List,0)
....................................=ROW(INDIRECT(”1:”&ROWS(List)))))))))
(Please replace .... by blank)
With indents on the left, the levels of the functions are more visible. At the moment I use \begin{tabbing} , \end{tabbing} , \= , \> ... to realize that.
However, one problem is that the lines are too long, and they exceed the margin. I want to make the font smaller to fit the length of line, but it seems that {tabbing} can not do that...
So i guess, either i use something else than {tabbing} to realize indents or make the font smaller... But i do not know neither of these ways... Does anyone have any idea?
Thanks and regards
Tie
General ⇒ tabbing or font size
NEW: TikZ book now 40% off at Amazon.com for a short time.

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
tabbing or font size
Use the listings package as shown in the code below.
For further information see the package manual.
Best regards and welcome to the board
Thorsten
Code: Select all
\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage[includeheadfoot,margin=2cm]{geometry}
\usepackage[svgnames]{xcolor}
\usepackage{listings}
\usepackage{lmodern}
\lstset{
aboveskip=1ex,
backgroundcolor=\color{gray!25},
basicstyle=\small\ttfamily,
belowskip=1ex,
breaklines=true,
columns=fullflexible,
framerule=0pt,
framexrightmargin=0em,
framexleftmargin=0em,
numbers=left,
numberstyle=\footnotesize\sffamily,
tabsize=2
}
\begin{document}
\begin{lstlisting}
=INDEX(List,
SMALL(IF(MATCH(List,List,0)
=ROW(INDIRECT("1:"&ROWS(List))),
MATCH(List,List,0),
""),
ROW(INDIRECT("1:"&SUM(SIGN(MATCH(List,List,0)
=ROW(INDIRECT("1:"&ROWS(List)))))))))
\end{lstlisting}
\end{document}
Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: tabbing or font size
Hi localghost,
Thanks very much for your code!
I have already made your code run inside my code, and i see the interest of using listings. However, the "intend" does not work 100% yet.
When I set "showspaces=true, tabsize=1", the printed output is exactly intended as my code, which is good; However, if I set "showspaces=false, tabsize=1", the position of each line changes a little bit.
Obviously I do not want to show spaces finally, do you see how to do to make printed lines intended as the code?
Thanks and regards
Tie CHENG
Thanks very much for your code!
I have already made your code run inside my code, and i see the interest of using listings. However, the "intend" does not work 100% yet.
When I set "showspaces=true, tabsize=1", the printed output is exactly intended as my code, which is good; However, if I set "showspaces=false, tabsize=1", the position of each line changes a little bit.
Obviously I do not want to show spaces finally, do you see how to do to make printed lines intended as the code?
Thanks and regards
Tie CHENG
tabbing or font size
Got it, we need to set lstset
keepspaces=true,
Regards
Tie CHENG
keepspaces=true,
Regards
Tie CHENG