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
11 votes
2 answers
176 views

Code Review: LaTeX Profiling in expl3

I have a pretty big template of packages/classes for multiple different document types. Some of the users sometimes complain that the compile times are soooo long. However, to find the bottlenecks of ...
Wulle's user avatar
  • 1,182
0 votes
1 answer
47 views

Add comma after journal title and "new series" (spelled out in full) in biblatex

My code: \documentclass{article} \usepackage[british]{babel} \usepackage[style=authoryear]{biblatex} \addbibresource{biblatex-examples.bib} \begin{document} Read \textcite{sarfraz}. Read \textcite{...
Lone Learner's user avatar
  • 3,176
0 votes
0 answers
50 views

Evalution of new version command / Code review

I'm still newbie latex user, so I need help from advanced users to figure out in macros restrictions and their pitfalls Prerequisites: I need to extract filename from its path, and I found this ...
Avatar Mod's user avatar
1 vote
1 answer
1k views

easyreview package : setreviewsoff not working

I have been working on a personal template for preparing my papers in case some journal don't have one. In the way, I found the easyReview package and the commands \setreviewsoff or \setreviewson ...
Vladimir Heredia's user avatar
1 vote
1 answer
35 views

Looking for a better layout or style in writing solutions of equations

Before I proceed to write a lot of solutions, I want to adopt a style that I will use consistently in my document. So far I write a solution of an equation as follows. Could you review this ? Any ...
Second Person Shooter's user avatar
0 votes
1 answer
83 views

Is this a good way to change \section in document using luacode? Or could this be done using plain Latex macro?

I wanted to do simple thing. Change each \section to \cprotect\section in the whole document. I could not figure out how to do it using latex macro. So I used lua I'd like to ask if you think this ...
Nasser's user avatar
  • 20.1k
4 votes
1 answer
340 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 ...
gwrukrisc's user avatar
1 vote
1 answer
286 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): \...
bp99's user avatar
  • 605
1 vote
0 answers
66 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 ...
PascalS's user avatar
  • 654
6 votes
1 answer
308 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 ...
N3buchadnezzar's user avatar
12 votes
4 answers
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 ...
N3buchadnezzar's user avatar
2 votes
0 answers
150 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 ...
kabanus's user avatar
  • 219
4 votes
2 answers
350 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-...
user avatar
2 votes
2 answers
129 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{...
Second Person Shooter's user avatar
5 votes
1 answer
3k 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{...
kosa's user avatar
  • 251
5 votes
1 answer
357 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) ...
current_user's user avatar
  • 5,235
6 votes
1 answer
362 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); ...
current_user's user avatar
  • 5,235
2 votes
0 answers
406 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 }, ...
current_user's user avatar
  • 5,235
2 votes
1 answer
116 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,...
The Real Masochist's user avatar
4 votes
1 answer
203 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 ...
The Real Masochist's user avatar
1 vote
2 answers
900 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) ...
alphacapture's user avatar
9 votes
2 answers
2k 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 ...
Willie Wong's user avatar
  • 23.1k
28 votes
3 answers
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. ...
musarithmia's user avatar
  • 12.3k
8 votes
3 answers
329 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 ...
DevSolar's user avatar
  • 7,807
6 votes
2 answers
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 ...
gsl's user avatar
  • 699
4 votes
3 answers
385 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]{...
ltxEnthu's user avatar
  • 345
2 votes
1 answer
201 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-...
kiss my armpit's user avatar
8 votes
1 answer
9k 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? \...
kiss my armpit's user avatar
10 votes
3 answers
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 ...
dustin's user avatar
  • 18.5k
2 votes
1 answer
3k 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} \...
prafulfillment's user avatar
3 votes
1 answer
499 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[...
Erel Segal-Halevi's user avatar
14 votes
1 answer
4k 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 ...
azetina's user avatar
  • 28.6k
3 votes
1 answer
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 ...
Aaron Hall's user avatar
3 votes
1 answer
410 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)...
Svend Tveskæg's user avatar
8 votes
1 answer
180 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 ...
kiss my armpit's user avatar
5 votes
2 answers
190 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,-...
kiss my armpit's user avatar
3 votes
1 answer
452 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,% ...
wittmaan's user avatar
  • 265
4 votes
4 answers
940 views

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

Consider the following. Code % lualatex filename.tex \DocumentMetadata{} \documentclass{article} \usepackage{pst-eucl} \def\maksimumB{\fpeval{2*(1+3^(1/2))*\radius} } \def\maksimumH{\fpeval{(3+3^(...
Svend Tveskæg's user avatar
2 votes
1 answer
242 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{...
Svend Tveskæg's user avatar
3 votes
1 answer
162 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{...
Svend Tveskæg's user avatar
1 vote
2 answers
390 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} \...
Svend Tveskæg's user avatar
7 votes
3 answers
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 ...
Svend Tveskæg's user avatar
9 votes
3 answers
911 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} \...
6 votes
2 answers
487 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\...
Svend Tveskæg's user avatar
11 votes
4 answers
516 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,...
Svend Tveskæg's user avatar
5 votes
2 answers
313 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\...
Svend Tveskæg's user avatar
10 votes
4 answers
780 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} ...
Svend Tveskæg's user avatar
7 votes
2 answers
332 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} \...
Svend Tveskæg's user avatar
6 votes
2 answers
333 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 \...
Svend Tveskæg's user avatar
3 votes
0 answers
184 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 ...
Nils L's user avatar
  • 9,686