Questions tagged [code-review]

{code-review} asks for a review or possible improvement of the code used to create some output (typically a {diagram} or some structured format like a {title-page}).

Filter by
Sorted by
Tagged with
28
votes
3answers
2k views

Make fireworks with only text

For the holidays, I wanted to follow up to the question about making fireworks with tikz (How can we display fireworks?): How can we make fireworks with only text? I have made a crude attempt below. ...
13
votes
1answer
3k views

Code improvement on a title page design

I am designing a new title page to post in the topic Showcase of beautiful title page done in TeX but am having some issues with the code I wrote. I don't like and I know it can be improved. In ...
12
votes
4answers
4k views

Draw a checker pattern with a black X in the center

I am trying to recreate the following image in TikZ Using some old code I was able to produce the following result While I was able to produce the correct result, I feel that my solution was a bit ...
11
votes
4answers
478 views

Improve PSTricks code for drawing of a chest of drawers

Consider the following example. Code % pdflatex -shell-escape test.tex \documentclass{article} \usepackage{auto-pst-pdf,pstricks-add} \begin{document} \psset{unit=0.08cm} \begin{pspicture}(45,...
10
votes
3answers
1k views

TikZ: How can I write my code more concisely?

I am learning how to use TikZ and want to learn ways to write more concise TikZ code. I feel I use many more lines than others may need to achieve the same results. In particular, I want to learn a ...
10
votes
4answers
657 views

How to improve my PSTricks code to construct a triangle diagram?

This question is similar to How to improve my PSTricks code to construct a triangle number diagram?. Consider the following example. Code % pdflatex -shell-escape test.tex \documentclass{article} ...
9
votes
3answers
761 views

Improve PSTricks code for drawing of a general, regular polygon

Consider the following example. Code % pdflatex -shell-escape test.tex \documentclass{article} \usepackage{auto-pst-pdf,pst-eucl,pst-poly,pstricks-add} \usepackage[locale=DE]{siunitx} \...
8
votes
1answer
7k views

Which one should I use to annotate equations? \tag or \text?

I am still confused in selecting whether to use \text or \tag for annotating equations. Which one should I use? If it is about personal preference, what is the pros and cons between them? \...
8
votes
3answers
271 views

Code review: Tables on a page

In a document I am working on, I am trying to group four tables on a single page. However, it seems I still have not one, but multiple issues with my understanding of how tables work... I tried to ...
8
votes
2answers
739 views

Temporarily changing catcode of %

Scenario I have a bunch of TeX files which may be processed by an external filter. The filter is (unfortunately) immutable: it does a string replacement where, for example, %d is expanded to a ...
8
votes
1answer
161 views

How to mimic LINQ's query method for macro's key-value?

Inspired by LINQ's query method, such as deck.Take(randomCount) .Where (card => card.Suit == "Hearts") .Skip(2) .Take(5) .OrderBy (card => card.FaceValue); The deck which is an ...
7
votes
3answers
1k views

Improve PSTricks code for drawing of the Olympic flag

Consider the following example. Code % pdflatex -shell-escape test.tex \documentclass{article} \usepackage{auto-pst-pdf,pstricks-add} \usepackage[locale=DE]{siunitx} \ExplSyntaxOn \cs_new_eq:NN ...
7
votes
2answers
305 views

How to improve my PSTricks code to construct a triangle number diagram?

This question is similar to How to improve my PSTricks code to construct a triangle diagram?. Consider the following example. Code % pdflatex -shell-escape test.tex \documentclass{article} \...
6
votes
1answer
87 views

Make tikzpicture take remaining space of page

I am trying to place three rectangles on a page using tikz with these equirements The two first boxes should have an height of 3.5 (as in my code) The remaining box should take the remaining space of ...
6
votes
2answers
2k views

Better idiomatic way to print a centered “starlet” (asterisk)?

I need to print what the publisher calls "a starlet" (asterisk). I devised the code below, but I am not sure if it is a sound code, i.e., it won't cause problems later on, within other commands and ...
6
votes
2answers
462 views

Improve PSTricks code for drawing of a football pitch

Consider the following example. Code % pdflatex -shell-escape test.tex \documentclass{article} \usepackage{auto-pst-pdf,pstricks-add} \usepackage{siunitx} \begin{document} % Paremeters \def\...
6
votes
2answers
318 views

Code improvement for PSTricks figure

Consider the following example. Code \documentclass{article} \usepackage{pstricks-add} \begin{document} \def\laengde{60 } \psset{unit=0.04} \begin{pspicture}(260,260) \pnode(0,0){P1} \pnode(!0 \...
6
votes
1answer
241 views

How can a node remember it's previous position?

Consider the following MWE: \documentclass[border=5pt,tikz]{standalone} \begin{document} \foreach \n in {2,3,...,20} { \begin{tikzpicture} \useasboundingbox (-6,-4) rectangle (2,1); ...
5
votes
2answers
182 views

How to buffer the extreme value of f(x) to draw a line representing a range of f(x)?

Please consider the following animation. \documentclass[pstricks,border=12pt]{standalone} \usepackage{pst-plot} \def\f{x^2-x-6} \psset{unit=3,algebraic} \def\Atom#1{% \begin{pspicture}(-1.5,-6.5)(2,-...
5
votes
2answers
305 views

Optimize (or improve, at least) PSTricks code for drawing a beehive

Consider the following example. Code % pdflatex -shell-escape test.tex \documentclass{article} \usepackage{ auto-pst-pdf, pst-eucl } \usepackage{siunitx} \begin{document} \begin{figure} \def\...
5
votes
1answer
928 views

Circuit diagram with tikz

Hi I am trying to draw the following circuit: using Tikz package in Latex. The following is my code \begin{figure}[t] \begin{center} \ctikzset{bipoles/length=1cm} \begin{...
5
votes
1answer
186 views

Improvements for conveyor belt in TikZ

Consider the following MWE: \documentclass[border=5pt,tikz]{standalone} \begin{document} \foreach \n in {0,-10,...,-720} { \begin{tikzpicture} \useasboundingbox (-3,-3) ...
4
votes
3answers
361 views

Like to know how my code can be improved!

I would like to know better way of accomplishing the following figure than the code I used. I'm used to for loops, but not to LaTeX loops! THE CODE \documentclass[a4paper,11pt,x11names,svgnames]{...
4
votes
4answers
829 views

Improvement of PSTricks code for drawing of balls in a triangular box

Consider the following. Code % pdflatex -shell-escape test.tex \documentclass{article} \usepackage{auto-pst-pdf,pst-eucl} \usepackage{expl3} \ExplSyntaxOn \cs_new_eq:NN \calc \fp_eval:n \...
4
votes
2answers
132 views

How to show a point name?

The circle Mixtilinear. \documentclass[12pt,a4paper]{article} \usepackage{amsmath,amssymb,newcent} \usepackage{pstricks} % required package \usepackage{pst-node,pst-func,pst-plot,pst-eucl,pstricks-...
4
votes
1answer
176 views

How can I change the number of iterations from 11 to 3?

The simplified example given below currently uses 11 iterations just for drawing at most 3 stems (vertical segments). It seems that my code is not efficient enough so I want to reduce the number of ...
4
votes
1answer
88 views

Newspaper layout

This is the template for my school newspaper that I maintain. It contains bits and pieces from everywhere (we all need to start start somewhere). I am aware that there are probably a lot that I can ...
3
votes
1answer
1k views

LaTeX Resume, Code Review for style and advice

I am using the code-review tag. I would like to get feedback on my Resume. I started out with another's CV, but I pared it back to almost nothing and expanded it in a totally different style. I would ...
3
votes
1answer
345 views

Building a flowchart with PSTricks

I am building several flow-charts similar to this. They represent a procedure (algorithm) for dividing a triangle. Right now, I use the following code: \newcommand{\thetriangle}{ \pspolygon[...
3
votes
1answer
357 views

Tikz - Thick line by overlapping rectangles - How to improve the diagram

I create my diagram with the following code. \documentclass{article} % \usepackage[ngerman]{babel} \usepackage{tikz} \usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,% ...
3
votes
1answer
345 views

Improve ugly PSTricks code [closed]

Consider the following code: \documentclass{article} \usepackage{pstricks-add} \psset{unit = 0.47\psunit, fillstyle = solid} \begin{document} \begin{pspicture}(0.5,1)(25,12.7) \psframe(3,1)(10,10)...
3
votes
1answer
156 views

Definition of PSTricks constant and improvement of code for drawing of Pantheon

Consider the following. Code % pdflatex -shell-escape test.tex \documentclass{article} \usepackage{ auto-pst-pdf, pst-eucl, pstricks-add } \usepackage{siunitx} \begin{document} \begin{...
3
votes
0answers
179 views

Optimizing tikz code for less redundancies [closed]

I don't use tikz very often. When I do, I'm usually pretty happy with the result (and with how useful that manual is). But I always think the code I produced to get there could be optimized, as in the ...
2
votes
2answers
74 views

What is the recommended method to have an image lie side by side with a list?

What I am doing below should suffice but I invite any other better ways. Is there any other better ones? \documentclass[preview,border=12pt,12pt]{standalone} \usepackage{enumitem,graphicx} \begin{...
2
votes
1answer
80 views

How to rewrite the looping below with nested ifelse operators?

Could you rewrite the looping part just with nested PostScript ifelse operators? \documentclass[pstricks,border=1cm]{standalone} \makeatletter \def\scale{% \psline(100,0) \foreach \x in {0,...
2
votes
1answer
169 views

How to iterate a list of colors with two additional counters more elegantly?

A part of my code (especially iterating a list of colors with 2 additional counters) below does not seem straightforward. \documentclass[pstricks,border=12pt,dvipsnames]{standalone} \usepackage{pst-...
2
votes
1answer
229 views

Improvement of PSTricks code for drawing of Pantheon

Consider the following example. Code % pdflatex -shell-escape test.tex \documentclass{article} \usepackage{ auto-pst-pdf, pst-eucl, pstricks-add } \usepackage[ locale=DE ]{siunitx} \begin{...
2
votes
1answer
2k views

Need to remove blank page

I have a blank page in the middle of my document that I'm unsure how to remove. Beginning \documentclass{article} \usepackage[a6paper, top=1cm, bottom=1cm, left=1pt, right=1cm]{geometry} \...
2
votes
0answers
75 views

tikz animation on beamer slide - centering and improvements

The code below animates 4 simple, nearly identical, processes, maybe familiar to many of you. Each time it adds the completed picture to the list at the top. My main issue is centering - I am having ...
2
votes
0answers
161 views

Improvements for Lissajous curve

I was working on following MWE: \documentclass[border=5pt,tikz]{standalone} \usepackage{bookman} \usetikzlibrary{backgrounds} \tikzset{ io/.style={ fill=black,circle,inner sep=.5pt }, ...
1
vote
2answers
365 views

Definition of PSTricks constant (again) and improvement of code

Consider the following example. (This is either the last one or the second to last.) Code % pdflatex -shell-escape test.tex \documentclass{article} \usepackage{auto-pst-pdf,pstricks-add} \...
1
vote
2answers
302 views

TikZ Code Review Request: Arrow pointing to circle from inside through two points

The code at the bottom produces the correct drawing, shown below. The issue is that I don't think I drew it in the best way possible; in particular, I really don't like having to construct (X) or (Y) ...
1
vote
1answer
61 views

How can I nicely format my form in LaTeX?

I am in need for a little authorization form and decided that this is great opportunity to use LaTeX. Here is what I have so far (minimized, translated to English—not the actual form of course): \...
1
vote
0answers
29 views

Code review for a self created .sty file

I will start to write my masterthesis in the next weeks with LaTeX. I have build my own .sty and integrated it into my document. Everything works fine and it looks like it should but it would be great ...