Math & Science ⇒ Small Squares with special Filling
-
- Posts: 14
- Joined: Tue Aug 07, 2012 2:50 pm
Small Squares with special Filling
Hello,
I proposed my wife to re-format her PhD thesis in LaTeX, but today she challenged me with this difficult figure legend: If there is a way to do this I would be really happy to know, as the submission date is very soon. I would be surprised, however... In Word it's made with rectangles, not with special characters.
Thanks in advance
I proposed my wife to re-format her PhD thesis in LaTeX, but today she challenged me with this difficult figure legend: If there is a way to do this I would be really happy to know, as the submission date is very soon. I would be surprised, however... In Word it's made with rectangles, not with special characters.
Thanks in advance
Last edited by localghost on Wed Sep 12, 2012 7:07 pm, edited 3 times in total.
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
Small Squares with special Filling
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
-
- Posts: 14
- Joined: Tue Aug 07, 2012 2:50 pm
Small Squares with special Filling
The example I provided did not show the right thing. Can you have another look? Now I edited the link and made it as an image...
Sorry
Thanks for the fast reply
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Re: Small Squares with special Filling
My last reply still applies.
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
-
- Posts: 14
- Joined: Tue Aug 07, 2012 2:50 pm
Small Squares with special Filling
Yes indeed it seems to be possible with tikZ. Thanks. I am now reading the manual. However it seems not too straightforward at first glance to get the thing aligned with the text, within a figure caption...localghost wrote:My last reply still applies.
I know I'm asking a lot here, but if somebody efficient in this package could provide me with an example code that I can modify, this would save me a sleepless night...
Thanks anyway. This is one of the best communities of the web!
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Small Squares with special Filling
I'd suggest that you start on your own and report back with some code when running into trouble. So we would be able to do corrections almost instantly. Otherwise this sounds like "Do this for me", you know.sdelandtsheer wrote:[…] I know I'm asking a lot here, but if somebody efficient in this package could provide me with an example code that I can modify, this would save me a sleepless night. […]
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
-
- Posts: 14
- Joined: Tue Aug 07, 2012 2:50 pm
Re: Small Squares with special Filling
Got it. It was easier than expected. Great package I'll post some code later for the example
Thanks a lot
Thanks a lot
-
- Posts: 14
- Joined: Tue Aug 07, 2012 2:50 pm
Small Squares with special Filling
Here it is, for the beginning :
Code: Select all
Code, edit and compile here:
\documentclass{article}\usepackage{tikz}\begin{document}Figure 1: Structure of the GR gene (NR3C1; OMIM + 138040; NR3C1; 5q31-q32), the potential mRNA transcripts and the binding sites within the CpG island.Panel A The genomic structure of the GR.\begin{tikzpicture}\draw (0,0) rectangle (0.33,0.33);\draw[gray, ultra thick](0.05,0) -- (0.05,0.33) (0.17,0) -- (0.17,0.33) (0.29,0) -- (0.29,0.33);\end{tikzpicture}5' untranslated distal exons;\end{document}
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Small Squares with special Filling
You can simplify that a bit by defining some useful macros in order to avoid always inserting a
The
tikzpicture
environment.
Code: Select all
Code, edit and compile here:
\documentclass[11pt]{article}\usepackage[T1]{fontenc}\usepackage{tikz}\usetikzlibrary{patterns}\newcommand*{\fillbox}[1][white]{%\tikz\draw[fill=#1] (0,0) rectangle (1.75ex,1.75ex);%}\newcommand{\patternbox}[2][black]{%\tikz\draw[pattern=#2,pattern color=#1] (0,0) rectangle (1.75ex,1.75ex);%}\begin{document}The quick brown fox jumps over the pazy dog (\patternbox[gray]{grid}). The quick brown fox jumps over the pazy dog. (\fillbox[gray!50]).\end{document}
pattern
option simplifies a different style for the boxes. For an overview of available patterns take a look at Section 42 of the pgf/tikZ manual.- Attachments
-
- The resulting output.
- tikZ-filled-boxes.png (7.99 KiB) Viewed 6662 times
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